Skip to content

Instantly share code, notes, and snippets.

View pfftdammitchris's full-sized avatar
💭
Dreaming

Christopher Tran pfftdammitchris

💭
Dreaming
View GitHub Profile
function Egg() {...}
// the curry func
function prepareCooking(cook) {
return function(egg1) {
return function(egg2) {
return function(egg3) {
return function(egg4) {
return cook(egg1, egg2, egg3, egg4)
}
let collect = start(new Egg())
collect = collect(new Egg())
collect = collect(new Egg())
function prepareCooking(cook) {
return function(egg1) {
return function(egg2) {
return function(egg3) {
// HERE
return function(egg4) {
return cook(egg1, egg2, egg3, egg4)
}
}
}
function curry(fn) {
return function curried() {
const args = Array.prototype.slice.call(arguments)
const done = args.length >= fn.length
if (done) {
return fn.apply(this, args)
} else {
return function() {
const args2 = Array.prototype.slice.call(arguments)
return curried.apply(this, args.concat(args2))
const curry = (fn) => {
return function curried(...args) {
const done = args.length >= fn.length
if (done) {
return fn.apply(this, args)
} else {
return (...args2) => curried.apply(this, [...args, ...args2])
}
}
}
const curry = (fn) => {
return function curried(...args) {
const done = args.length >= fn.length
if (done) {
return fn.apply(this, args)
} else {
return (...args2) => curried.apply(this, [...args, ...args2])
}
}
}
@pfftdammitchris
pfftdammitchris / cloudSettings
Last active May 14, 2021 14:02
VSCode User Settings 01/08/20
{"lastUpload":"2021-05-14T14:01:55.433Z","extensionVersion":"v3.4.3"}
const novice = { username: 'henry123', level: 10, hp: 100 }
function transform(target) {
return Object.assign(target, {
fireBolt(player) {
player.hp -= 15
return this
},
})
}
const novice = { username: 'henry123', level: 10, hp: 100 }
function transform(target) {
return {
...target,
fireBolt(player) {
player.hp -= 15
return this
},
}
import React from 'react'
import {
EditIcon,
DeleteIcon,
ResetIcon,
TrashIcon,
UndoIcon,
} from '../lib/icons'
import * as utils from '../utils