Skip to content

Instantly share code, notes, and snippets.

function ColorMap(width, height, value){
var i, j, k, l, f;
var c, cx, gr, cs, imageData;
var min, max;
var arr;
// arguments check
if(Object.prototype.toString.call(value) !== '[object Array]'){return null;}
if(value.length < 2){return null;}
f = true;
for(i = 0, j = value.length; i < j; ++i){
function bezier(t, p0, p1, p2, p3){
var x = (1 - t) * (1 - t) * (1 - t) * p0[0] +
3 * (1 - t) * (1 - t) * t * p1[0] +
3 * (1 - t) * t * t * p2[0] +
t * t * t * p3[0];
var y = (1 - t) * (1 - t) * (1 - t) * p0[1] +
3 * (1 - t) * (1 - t) * t * p1[1] +
3 * (1 - t) * t * t * p2[1] +
t * t * t * p3[1];
return [x, y];
# Path to your oh-my-zsh installation.
export ZSH=/Users/xxxxxx/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="avit"
# Uncomment the following line to use case-sensitive completion.
{
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"arrowFunctions": true,
"blockBindings": true,
"classes": true,
"destructuring": true,
"modules": true,
function fullscreenRequest(){
if(screenCanvas.requestFullscreen){
screenCanvas.requestFullscreen();
}else if(screenCanvas.webkitRequestFullscreen){
screenCanvas.webkitRequestFullscreen();
}else if(screenCanvas.mozRequestFullscreen){
screenCanvas.mozRequestFullscreen();
}else if(screenCanvas.msRequestFullscreen){
screenCanvas.msRequestFullscreen();
}
@doxas
doxas / easing.js
Last active February 4, 2016 15:55
function easing(t){
return t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
}
function easeOutCubic(t){
return (t = t / 1 - 1) * t * t + 1;
}
function easeQuintic(t){
var ts = (t = t / 1) * t;
function convertTimeToSerial(d){
var e = new Date(d);
var year = e.getYear() + 1900;
var month = zeroPadding(e.getMonth() + 1, 2);
var day = zeroPadding(e.getDate(), 2);
var hour = zeroPadding(e.getHours(), 2);
var minute = zeroPadding(e.getMinutes(), 2);
return year + '/' + month + '/' + day + ' ' + hour + ':' + minute;
}
@doxas
doxas / zeropadding.js
Last active February 1, 2016 06:02
zeropadding.js
function zeroPadding(s, n){
if(s == null || Object.prototype.toString.call(s) !== "[object Number]"){return '';}
if(n == null || Object.prototype.toString.call(n) !== "[object Number]"){return '';}
if(n <= 0){return '';}
var nega = (s < 0);
var float = ((s + '').match(/\./) != null);
var target = float ? Math.floor(s) : s;
if(nega){target *= -1;}
if(target >= Math.pow(10, n)){return s + '';}
var conv = (new Array(n).join('0') + target).slice(-n);
git config --global core.excludesfile ~/.gitignore_global
log --graph --decorate=full --stat --oneline --remotes --branches -10