Skip to content

Instantly share code, notes, and snippets.

View khanglu's full-sized avatar

Khang Lu khanglu

View GitHub Profile
@khanglu
khanglu / iterm2colorconfig.json
Created April 19, 2017 06:31
iterm2 color config
{
"Ansi 6 Color" : {
"Green Component" : 0.5133699178695679,
"Blue Component" : 0.5209967494010925,
"Red Component" : 0.4681892693042755
},
"Tags" : [
],
"Ansi 12 Color" : {
@khanglu
khanglu / functionDeclaration.js
Created March 26, 2017 04:47
ES6 function declaration
const chainedAddition = a => b => console.log(a+b)
const chainedAddition = (a) => {
return (b) => {
console.log(a+b)
}
}
var chainedAddition = function chainedAddition (a) {
return function (b) {
@khanglu
khanglu / curriedExample2.js
Last active March 26, 2017 04:53
Curried execution example
const enhancer = addCurried(1)
// addCurried(1) returns a function in the form of
// b => console.log(a+b) with a = 1
// which is stored in variable enhancer
enhancer(2)
// Execute enhancer with b = 2, result is 3
@khanglu
khanglu / curriedExample.js
Last active March 26, 2017 02:03
Example of curried function in ES6
const add = (a, b) => console.log(a + b)
add(1, 2) // Result is 3
const addCurried = a => b => console.log(a + b)
addCurried(1)(2) // Result is also 3
const anotherAddCurried = a => b => c => console.log(a + b + c)