Skip to content

Instantly share code, notes, and snippets.


YuMeiJie Gyumeijie

Block or report user

Report or block Gyumeijie

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View addQueryParameters
function addQueryParameters (url, parameters) {
const separator = /\?/.test(url) ? '&' : '?'
const names = Object.keys(parameters)
if (names.length === 0) {
return url
return url + separator + names
.map(name => {
Gyumeijie /
Created May 3, 2018 — forked from andreyvit/
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

# remap prefix to Control + a
View eventloop
1. 为什么JavaScript是单线程? ---为什么不是多线程呢
Gyumeijie / redux middleware
Last active Mar 9, 2018
some beautiful design
View redux middleware
1. 中间件接口
{dispatch, getState} => next => action => your code
Gyumeijie / Array
Last active Mar 9, 2018
usage of some important javascript functions
View Array
1. Array.reduce
If an initialValue was provided in the call to reduce, then previousValue will be equal to initialValue
and currentValue will be equal to the first value in the array.
If no initialValue was provided, then previousValue will be equal to the first value in the array
and currentValue will be equal to the second
View arrow function
###Arrow functions do not have this, arguments or other special names bound at all###
when the object is being created the name this is found in the enclosing scope.
var person = {
name: "ymj",
shout: () => console.log("my name is ",
View JSX
Babel compiles JSX down to React.createElement() calls.
const element = ( const element = React.createElement(
<h1 className="greeting"> 'h1', -----> element
Hello, world! {className: 'greeting'}, -----> props of the element
</h1> 'Hello, world!' -----> children(include element and text node)
); );
View action
function addTodo(text) {
return {
type: ADD_TODO,
dispatch就是把action对象发送出去, 结合Action Creator发送动作的代码可以这样写
View CSS statements
There are two kinds of statements:
1. Rulesets (or rules) that, as seen, associate a collection of CSS declarations to a condition described by a selector.
2. At-rules that start with an at sign, '@', followed by an identifier and then continuing up the end of the statement,
Rulesets are the main building blocks of a style sheet, which often consists of only a big list of them.
But there is other information that a Web author wants to convey in the style sheet, like the character set,
other external style sheets to import, font face or list counter descriptions and many more.
View npm-run-srcipt
npm run-script <command> [--silent] [-- <args>...] alias: npm run
Given the following package.json snippet:
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "babel src -d dist",
"run": "node dist/main.js"
You can’t perform that action at this time.