📅  最后修改于: 2023-12-03 14:59:55.222000             🧑  作者: Mango
As a programmer, sometimes it can be difficult to remember all the syntax, commands and shortcuts for every programming language or tool you may use. This cheat sheet was created to serve as a quick reference guide for common programming tasks and syntax.
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>Heading 1</h1>
<p>Paragraph</p>
</body>
</html>
<img src="image.jpg" alt="description of image">
<a href="https://example.com">Link Text</a>
/* element selector */
h1 {
color: red;
}
/* class selector */
.className {
font-size: 18px;
}
/* ID selector */
#myID {
background-color: #ccc;
}
/* margin */
.element {
margin: 10px;
}
/* padding */
.element {
padding: 5px;
}
/* border */
.element {
border: 1px solid #000;
}
let x = 5;
const PI = 3.14;
function functionName(param1, param2) {
// function code
}
// arrow function
const functionName = (param1, param2) => {
// function code
}
// for loop
for (let i = 0; i < 10; i++) {
// loop code
}
// while loop
while (condition) {
// loop code
}
// do-while loop
do {
// loop code
} while (condition)
x = 5
PI = 3.14
def functionName(param1, param2):
# function code
# lambda function
lambda_function = lambda param1, param2: param1 + param2
# for loop
for i in range(10):
# loop code
# while loop
while condition:
# loop code
# for-each loop
for item in list:
# loop code
# clone a repo
git clone https://github.com/username/repo.git
# add changes to staging area
git add .
# commit changes
git commit -m "commit message"
# push changes to remote repo
git push origin master
# pull changes from remote repo
git pull origin master
# create a new branch
git checkout -b newBranch
# switch to an existing branch
git checkout existingBranch
# merge branches
git checkout master
git merge newBranch
# open command palette
Ctrl + Shift + P
# search for a file
Ctrl + P
# select all occurrences of a word
Ctrl + Shift + L
# comment out a line
Ctrl + /
# format code
Shift + Alt + F
This cheat sheet is by no means an exhaustive reference guide, but it should be helpful in many common programming tasks. Feel free to add to it or customize it for your own needs. Happy programming!