Skip to content

Instantly share code, notes, and snippets.

View index.js
"use strict";
var COLORS = {
BOX: 'silver',
BEZIER: 'silver',
BACKGROUND : {
COLOR: 'whitesmoke',
TEXT: 'black'
},
POINTS: 'gray',
GRID: 'rgba(80,80,80,0.1)',
@kentaromiura
kentaromiura / index.js
Created Jul 17, 2014
requirebin sketch
View index.js
var Promise = require('promise')
var request = function(options){
// faking async http request
setTimeout(options.success, 3000, {
zivc: 'use the force'
})
}
var fakeAPI = {
@kentaromiura
kentaromiura / transform.js
Created Jul 5, 2014
Feature detection for applying a transform
View transform.js
var transform = (function(){
for(var props = ['transform', 'webkitTransform', 'OTransform', 'msTransform', 'MozTransform'], i=0, max=props.length; i<max; i++){
var prop = props[i]
if(prop in document.body.style){
return function(element, transformation){
element.style[prop] = transformation
}
}
}
})();
@kentaromiura
kentaromiura / mostAnnoyingConsoleFunctionEver.js
Last active Aug 29, 2015 — forked from zivc/mostAnnoyingConsoleFunctionEver.js
amend the mostAnnoyingConsoleFunctionEver to use the proper font
View mostAnnoyingConsoleFunctionEver.js
console.log = (function(log){
return function(str) {
var css = 'background: linear-gradient(to right, red, yellow, lime, aqua, blue, fuchsia, red); color: white; font-weight: bold;font-family:Comic Sans MS;font-size:13pt;';
var args = Array.prototype.slice.call(arguments);
args[0] = '%c' + args[0];
args.splice(1,0,css);
var speech = new SpeechSynthesisUtterance();
speech.text = str;
window.speechSynthesis.speak(speech);
@kentaromiura
kentaromiura / index.js
Created Jun 16, 2014
requirebin sketch
View index.js
var prime = require('prime')
var emitter = require('prime/emitter')
var transition = require('transition')
var enhance = function(instance, method, parameters){
var result = Fx.parent[method].apply(instance, parameters)
instance.event.emit(method, result)
return result
}
var Fx = prime({
@kentaromiura
kentaromiura / index.js
Created Jun 16, 2014
requirebin sketch
View index.js
var div = document.createElement('div');
div.innerHTML = atob('CjxkaXY+CiAgICA8cHJlPiAgICAgICAgTG9yZW0gSXBzdW0gaXMgc2ltcGx5IGR1bW15IHRleHQgb2YgdGhlIHByaW50aW5nIGFuZDxicj4gdHlwZXNldHRpbmcgaW5kdXN0cnkuIExvcmVtIElwc3VtIGhhcyBiZWVuIHRoZSBpbmR1c3RyeSdzPGJyPiBzdGFuZGFyZCBkdW1teSB0ZXh0IGV2ZXIgc2luY2UgdGhlIDE1MDBzLCB3aGVuIGFuIHVua25vd248YnI+IHByaW50ZXIgdG9vayBhIGdhbGxleSBvZiB0eXBlIGFuZCBzY3JhbWJsZWQgaXQgdG8gbWFrZSBhPGJyPiB0eXBlPGJyPiBzcGVjaW1lbiBib29rLiBJdCBoYXMgc3Vydml2ZWQgbm90IG9ubHkgZml2ZTxicj4gY2VudHVyaWVzLCBidXQgYWxzbyB0aGUgbGVhcCBpbnRvIGVsZWN0cm9uaWMgdHlwZXNldHRpbmcsPGJyPiByZW1haW5pbmcgZXNzZW50aWFsbHkgdW5jaGFuZ2VkLiBJdCB3YXMgcG9wdWxhcmlzZWQgaW4gdGhlPGJyPiAxOTYwczxicj4gd2l0aCB0aGUgcmVsZWFzZSBvZiBMZXRyYXNldCBzaGVldHMgY29udGFpbmluZzxicj4gTG9yZW08YnI+IElwc3VtIHBhc3NhZ2VzLCBhbmQgbW9yZSByZWNlbnRseSB3aXRoIGRlc2t0b3A8YnI+IHB1Ymxpc2hpbmcgc29mdHdhcmUgbGlrZSBBbGR1cyBQYWdlTWFrZXIgaW5jbHVkaW5nIHZlcnNpb25zIG9mPGJyPiBMb3JlbSBJcHN1bS48YnI+Cjxicj4KSXQgaXMgYSBsb25nIGVzdGFibGlzaGVkIGZhY3QgdGhhdCBhIHJlYWRlciB3aWxsIGJlIGRpc3RyYWN0
@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
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'),
View index.js
var global = window,
div = document.createElement('div');
div.innerHTML = atob('CjxzY3JpcHQgaWQ9InNoYWRlci1mcyIgdHlwZT0ieC1zaGFkZXIveC1mcmFnbWVudCI+CnByZWNpc2lvbiBtZWRpdW1wIGZsb2F0OwoKICB2YXJ5aW5nIHZlYzQgdkNvbG9yOwoKICB2b2lkIG1haW4odm9pZCkgewogICAgZ2xfRnJhZ0NvbG9yID0gdkNvbG9yOwogIH0KPC9zY3JpcHQ+Cgo8c2NyaXB0IGlkPSJzaGFkZXItdnMiIHR5cGU9Ingtc2hhZGVyL3gtdmVydGV4Ij4KICAgICAgYXR0cmlidXRlIHZlYzMgYVZlcnRleFBvc2l0aW9uOwogIGF0dHJpYnV0ZSB2ZWM0IGFWZXJ0ZXhDb2xvcjsKCiAgdW5pZm9ybSBtYXQ0IHVNVk1hdHJpeDsKICB1bmlmb3JtIG1hdDQgdVBNYXRyaXg7CgogIHZhcnlpbmcgdmVjNCB2Q29sb3I7CgogIHZvaWQgbWFpbih2b2lkKSB7CiAgICBnbF9Qb3NpdGlvbiA9IHVQTWF0cml4ICogdU1WTWF0cml4ICogdmVjNChhVmVydGV4UG9zaXRpb24sIDEuMCk7CiAgICB2Q29sb3IgPSBhVmVydGV4Q29sb3I7CiAgfQo8L3NjcmlwdD4KICAgIAo=');
document.body.appendChild(div)
var matrix3d = require('matrix3d')
You can’t perform that action at this time.