Skip to content

Instantly share code, notes, and snippets.

@kentaromiura
kentaromiura / Object.get.js
Created Feb 25, 2014
Object.get implementation
View Object.get.js
module.exports = function(object, path, defaultValue){
/*
if(arguments.length == 2){ // generic pattern
defaultValue = path;
path = object;
object = this;
}
*/
var result = defaultValue,
paths = path.split('.'),
@kentaromiura
kentaromiura / index.js
Created May 30, 2014
requirebin sketch
View index.js
var prime = require("prime"),
defer = require("prime/defer");
var Transition = require('transition')
var forIn = require('mout/object/forIn');
var slice_ = Array.prototype.slice;
@kentaromiura
kentaromiura / index.js
Created May 30, 2014
requirebin sketch
View index.js
var prime = require("prime"),
defer = require("prime/defer");
var Transition = prime({
constructor: function Transition(duration, equation, callback) {
if (!duration) throw new Error('no duration given');
if (!equation) throw new Error('no equation given');
if (!callback) throw new Error('no callback given');
@kentaromiura
kentaromiura / index.js
Created May 30, 2014
requirebin sketch
View index.js
// example using the raf module from npm. try changing some values!
var requestAnimationFrame = require("raf")
var canvas = document.createElement("canvas")
canvas.width = 500
canvas.height = 500
document.body.appendChild(canvas)
var context = canvas.getContext("2d")
@kentaromiura
kentaromiura / index.js
Created May 30, 2014
requirebin sketch
View index.js
var prime = require("prime"),
defer = require("prime/defer");
var Transition = require('transition')
var forIn = require('mout/object/forIn');
var slice_ = Array.prototype.slice;
@kentaromiura
kentaromiura / index.js
Created May 31, 2014
requirebin sketch
View index.js
var global = window,
div = document.createElement('div');
div.innerHTML = atob('CjxzY3JpcHQgaWQ9InNoYWRlci1mcyIgdHlwZT0ieC1zaGFkZXIveC1mcmFnbWVudCI+CnByZWNpc2lvbiBtZWRpdW1wIGZsb2F0OwoKICB2YXJ5aW5nIHZlYzQgdkNvbG9yOwoKICB2b2lkIG1haW4odm9pZCkgewogICAgZ2xfRnJhZ0NvbG9yID0gdkNvbG9yOwogIH0KPC9zY3JpcHQ+Cgo8c2NyaXB0IGlkPSJzaGFkZXItdnMiIHR5cGU9Ingtc2hhZGVyL3gtdmVydGV4Ij4KICAgICAgYXR0cmlidXRlIHZlYzMgYVZlcnRleFBvc2l0aW9uOwogIGF0dHJpYnV0ZSB2ZWM0IGFWZXJ0ZXhDb2xvcjsKCiAgdW5pZm9ybSBtYXQ0IHVNVk1hdHJpeDsKICB1bmlmb3JtIG1hdDQgdVBNYXRyaXg7CgogIHZhcnlpbmcgdmVjNCB2Q29sb3I7CgogIHZvaWQgbWFpbih2b2lkKSB7CiAgICBnbF9Qb3NpdGlvbiA9IHVQTWF0cml4ICogdU1WTWF0cml4ICogdmVjNChhVmVydGV4UG9zaXRpb24sIDEuMCk7CiAgICB2Q29sb3IgPSBhVmVydGV4Q29sb3I7CiAgfQo8L3NjcmlwdD4KICAgIAo=');
document.body.appendChild(div)
var mat4 = require('gl-matrix').mat4;
View index.js
var global = window,
div = document.createElement('div');
div.innerHTML = atob('CjxzY3JpcHQgaWQ9InNoYWRlci1mcyIgdHlwZT0ieC1zaGFkZXIveC1mcmFnbWVudCI+CnByZWNpc2lvbiBtZWRpdW1wIGZsb2F0OwoKICB2YXJ5aW5nIHZlYzQgdkNvbG9yOwoKICB2b2lkIG1haW4odm9pZCkgewogICAgZ2xfRnJhZ0NvbG9yID0gdkNvbG9yOwogIH0KPC9zY3JpcHQ+Cgo8c2NyaXB0IGlkPSJzaGFkZXItdnMiIHR5cGU9Ingtc2hhZGVyL3gtdmVydGV4Ij4KICAgICAgYXR0cmlidXRlIHZlYzMgYVZlcnRleFBvc2l0aW9uOwogIGF0dHJpYnV0ZSB2ZWM0IGFWZXJ0ZXhDb2xvcjsKCiAgdW5pZm9ybSBtYXQ0IHVNVk1hdHJpeDsKICB1bmlmb3JtIG1hdDQgdVBNYXRyaXg7CgogIHZhcnlpbmcgdmVjNCB2Q29sb3I7CgogIHZvaWQgbWFpbih2b2lkKSB7CiAgICBnbF9Qb3NpdGlvbiA9IHVQTWF0cml4ICogdU1WTWF0cml4ICogdmVjNChhVmVydGV4UG9zaXRpb24sIDEuMCk7CiAgICB2Q29sb3IgPSBhVmVydGV4Q29sb3I7CiAgfQo8L3NjcmlwdD4KICAgIAo=');
document.body.appendChild(div)
var matrix3d = require('matrix3d')
View index.js
var global = window,
div = document.createElement('div');
div.innerHTML = atob('CjxzY3JpcHQgaWQ9InNoYWRlci1mcyIgdHlwZT0ieC1zaGFkZXIveC1mcmFnbWVudCI+CnByZWNpc2lvbiBtZWRpdW1wIGZsb2F0OwoKICB2YXJ5aW5nIHZlYzQgdkNvbG9yOwoKICB2b2lkIG1haW4odm9pZCkgewogICAgZ2xfRnJhZ0NvbG9yID0gdkNvbG9yOwogIH0KPC9zY3JpcHQ+Cgo8c2NyaXB0IGlkPSJzaGFkZXItdnMiIHR5cGU9Ingtc2hhZGVyL3gtdmVydGV4Ij4KICAgICAgYXR0cmlidXRlIHZlYzMgYVZlcnRleFBvc2l0aW9uOwogIGF0dHJpYnV0ZSB2ZWM0IGFWZXJ0ZXhDb2xvcjsKCiAgdW5pZm9ybSBtYXQ0IHVNVk1hdHJpeDsKICB1bmlmb3JtIG1hdDQgdVBNYXRyaXg7CgogIHZhcnlpbmcgdmVjNCB2Q29sb3I7CgogIHZvaWQgbWFpbih2b2lkKSB7CiAgICBnbF9Qb3NpdGlvbiA9IHVQTWF0cml4ICogdU1WTWF0cml4ICogdmVjNChhVmVydGV4UG9zaXRpb24sIDEuMCk7CiAgICB2Q29sb3IgPSBhVmVydGV4Q29sb3I7CiAgfQo8L3NjcmlwdD4KICAgIAo=');
document.body.appendChild(div)
var matrix3d = require('matrix3d'),
vector4 = require('matrix3d/lib/Vector4'),
transform3d = require('transform3d'),
View index.js
var global = window,
div = document.createElement('div');
div.innerHTML = atob('CjxzY3JpcHQgaWQ9InNoYWRlci1mcyIgdHlwZT0ieC1zaGFkZXIveC1mcmFnbWVudCI+CnByZWNpc2lvbiBtZWRpdW1wIGZsb2F0OwoKICB2YXJ5aW5nIHZlYzQgdkNvbG9yOwoKICB2b2lkIG1haW4odm9pZCkgewogICAgZ2xfRnJhZ0NvbG9yID0gdkNvbG9yOwogIH0KPC9zY3JpcHQ+Cgo8c2NyaXB0IGlkPSJzaGFkZXItdnMiIHR5cGU9Ingtc2hhZGVyL3gtdmVydGV4Ij4KICAgICAgYXR0cmlidXRlIHZlYzMgYVZlcnRleFBvc2l0aW9uOwogIGF0dHJpYnV0ZSB2ZWM0IGFWZXJ0ZXhDb2xvcjsKCiAgdW5pZm9ybSBtYXQ0IHVNVk1hdHJpeDsKICB1bmlmb3JtIG1hdDQgdVBNYXRyaXg7CgogIHZhcnlpbmcgdmVjNCB2Q29sb3I7CgogIHZvaWQgbWFpbih2b2lkKSB7CiAgICBnbF9Qb3NpdGlvbiA9IHVQTWF0cml4ICogdU1WTWF0cml4ICogdmVjNChhVmVydGV4UG9zaXRpb24sIDEuMCk7CiAgICB2Q29sb3IgPSBhVmVydGV4Q29sb3I7CiAgfQo8L3NjcmlwdD4KICAgIAo=');
document.body.appendChild(div)
var matrix3d = require('matrix3d'),
vector4 = require('matrix3d/lib/Vector4'),
transform3d = require('transform3d'),
@kentaromiura
kentaromiura / backbone.adapter.js
Created Jun 2, 2014
MooTools BackBone Adapter
View backbone.adapter.js
/**
* MooToolsAdapter 0.2
* For all details and documentation:
* http://github.com/inkling/backbone-mootools
*
* Copyright 2011 Inkling Systems, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
You can’t perform that action at this time.