Skip to content

Instantly share code, notes, and snippets.

View hkjpotato's full-sized avatar

KJ(Kaijie) Huang hkjpotato

  • atl/nyc/virtual
View GitHub Profile
@hkjpotato
hkjpotato / Pull Down to Refresh (Paper Plane).markdown
Created June 15, 2015 09:07
Pull Down to Refresh (Paper Plane)

Speedometer Animation

Cool speedometer performance animation I made for work using only css3 and keyframe animation.

A Pen by Daniel on CodePen.

License.

@hkjpotato
hkjpotato / box rotation directions .markdown
Created August 29, 2015 06:01
box rotation directions

css potato emoji

Pure CSS3 animated emoji. Good for understanding the box model. I call them potatoes and I plan to make 20 of them. Shoot me an email if you have any ideas about them:) hkjpotato@gmail.com

A Pen by Kaijie Huang on CodePen.

@hkjpotato
hkjpotato / curry2.js
Last active September 27, 2017 00:40
var numOfRequiredArguments = 5;
var fn = function() {
if (arguments.length < numOfRequiredArguments) {
return fn.bind(null, ...arguments);
} else {
console.log('we already collect 5 arguments: ', [...arguments]);
return null;
}
}
function fn2() {
var preset = Array.prototype.slice.call(arguments);
/*
originally:
return fn.bind(null, ...arguments);
*/
return function helper() {
var added = Array.prototype.slice.call(arguments);
return fn2.apply(null, [...preset, ...added]); //for simplity, use es6
}
function magician (targetfn) {
var numOfArgs = targetfn.length;
if (arguments.length - 1 < numOfArgs) {
return magician.bind(null, ...arguments);
} else {
return targetfn.apply(null, Array.prototype.slice.call(arguments, 1));
}
}
function magician(targetfn) {
var numOfArgs = targetfn.length;
return function fn() {
if (arguments.length < numOfArgs) {
return fn.bind(null, ...arguments);
} else {
return targetfn.apply(null, arguments);
}
}
}