Skip to content

Instantly share code, notes, and snippets.

View neo's full-sized avatar
😊
stay safe stay sane

Wenchen Li neo

😊
stay safe stay sane
View GitHub Profile
@neo
neo / css-module.d.ts
Created April 25, 2020 18:44
CSS/SCSS module definition files for TypeScript
declare module "*.module.css" {
const classNameMap: {
[className: string]: string;
};
export default classNameMap;
}
PROMPT='%{$fg[white]%}%c %{%(?.$fg[green].$fg[red])%}❯ %{$reset_color%}'
RPROMPT='$(parse_git_dirty)$(git_prompt_info)%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX=" "
ZSH_THEME_GIT_PROMPT_SUFFIX=" "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$bg[yellow]%}%{$fg[black]%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$bg[cyan]%}%{$fg[black]%}"
@neo
neo / code-list-extensions.txt
Last active September 28, 2018 19:57
code --list-extensions | pbcopy
EditorConfig.EditorConfig
christian-kohler.npm-intellisense
CoenraadS.bracket-pair-colorizer
dbaeumer.vscode-eslint
eg2.tslint
eg2.vscode-npm-script
esbenp.prettier-vscode
flowtype.flow-for-vscode
formulahendry.auto-close-tag
formulahendry.auto-rename-tag
{
"printWidth": 120,
"trailingComma": "all"
}
@neo
neo / settings.json
Last active March 16, 2019 20:21
VS Code settings from work
{
"terminal.integrated.fontFamily": "Fira Code",
"diffEditor.renderSideBySide": false,
"editor.renderWhitespace": "all",
"emmet.includeLanguages": {
"javascript": "javascriptreact",
"scss": "css"
},
"editor.formatOnSave": true,
"flow.useNPMPackagedFlow": true,
@neo
neo / git-config.global.sh
Last active November 30, 2022 21:02
Git Global Configs
git config --global user.name "Neo"
git config --global user.email "neo.li@jam3.com"
git config --global push.default current
git config --global commit.gpgsign true
git config --global credential.helper store
# http://editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
@neo
neo / NEO
Last active November 2, 2020 20:24
__ ___ ___________ __________
/ \ / / / ________/ / ______ \
/ \ / / / /_______ / / ) )
/ /\ \/ / / ________/ / / / /
/ / \ / / /_______ ( (______/ /
/__/ \__/ /__________/ \__________/
@neo
neo / prebind.md
Last active November 20, 2016 03:48

We used to pass a parent component's method as a prop to the child component like this:

<SomeComponent onClick={this._click.bind(this)} />

But according to the video I watched, it actually creates a reference in memory on that binded function each time React renders the component. And it's so long that we need to type .bind(this) every time we pass a method.

So they introduced a way to pre-bind the method in the constructor like this:

@neo
neo / ES2015.js
Last active July 27, 2017 21:57
Key ES2015 Features
function takesNamedParameters({ id, name } = {}) {
console.log(id, name);
}
// Rest parameters
function variadic(a, b, ...theArgs) {
return Array.isArray(theArgs); // true
}
let ary = [1, 2, 3, 4];
// Default function parameters