Skip to content

Instantly share code, notes, and snippets.

View a90100's full-sized avatar
:octocat:
Keep learning

Harry Xie a90100

:octocat:
Keep learning
View GitHub Profile
@a90100
a90100 / emmet
Created March 6, 2019 14:15
emmet
"emmet.triggerExpansionOnTab": true,
"emmet.includeLanguages": {
"vue-html": "html",
"vue": "html"
}
@a90100
a90100 / emmet2
Created March 6, 2019 14:36
emmet2
"emmet.triggerExpansionOnTab": true,
"emmet.syntaxProfiles": {
"vue": "pug sass"
},
"emmet.includeLanguages": {
"vue": "pug"
}
@a90100
a90100 / functions
Last active November 10, 2019 03:35
function fun1() {
console.log("fun1 start!");
}
function fun2() {
console.log("fun2 start!");
fun1();
}
function fun3() {
const attName = 'name';
let person = {
name: 'Harry',
age: 22
}
console.log(person[name]); // Harry
console.log(person.name); // Harry
const attName = 'name';
let person = {
attName: 'Harry',
age: 22
}
console.log(person[attName]); // undefined
// 這樣寫的話等同於 物件[屬性名]
console.log(person['attName']); // Harry
const attName = 'name';
let person = {
[attName]: 'Harry',
age: 22
}
console.log(person[attName]); // Harry
const classMates = ["Harry", "John", "Tom", "Mary", "Jerry"];
let classMatesList = {}
classMates.forEach((name, id) => {
classMatesList = {...classMatesList, ['Id' + ++id]: name}
})
console.log(classMatesList);
// { Id1: "Harry", Id2: "John", Id3: "Tom", Id4: "Mary", Id5: "Jerry" }
let person = {
name: 'Harry',
age: 22
}
let clonePerson = person;
person.name = 'John';
console.log(clonePerson.name); // 'John'
let stringA = "This is a string";
let stringB = stringA;
stringA = "The string has changed";
console.log(stringA); //The string has changed
console.log(stringB); //This is a string
console.log(stringA === stringB); //false
@a90100
a90100 / clean code.java
Created April 22, 2020 16:05
clean code.java
string name = employee.getName();
customer.setName("mike");
if (paycheck.isPosted()) {
// ...
}