This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//POSSIBLE CONDITIONAL SYNTAX | |
node1.matchesWidthOf( layout ) | |
.ifWidthGreaterThan( layout, 600 ).widthIsAPercentageOf( layout, 0.5 ) | |
.ifWidthSmallerThan( layout, 200 ).widthIsAPercentageOf( layout, 0.2 ); | |
//OTHER POSSIBLE CONDITIONAL SYNTAX | |
node1.matchesWidthOf( layout ) | |
.is( layout ).widthGreaterThan( 600 ).widthIsAPercentageOf( layout, 0.5 ) | |
.is( layout ).widthGreaterThan( 200 ).widthIsAPercentageOf( layout, 0.2 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require( 'fs' ); | |
var path = require( 'path' ); | |
var terminalMenu = require( 'terminal-menu' ); | |
var getUnderline = require( './getUnderline' ); | |
var FileBrowser = function( settings, onFileSelect ) { | |
this.title = settings.title || 'Browse browse browse'; | |
this.startIdx = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//originally from https://github.com/mattdiamond/Recorderjs/blob/master/recorder.js | |
var url = (window.URL || window.webkitURL).createObjectURL(data); | |
var link = window.document.createElement('a'); | |
link.href = url; | |
link.download = 'output.wav'; | |
var click = document.createEvent("Event"); | |
click.initEvent("click", true, true); | |
link.dispatchEvent(click); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugin( req ) | |
.model( require( '../model' ) ) | |
.dataHBS( require( 'fs' ).readFileSync( './src/hbs/record.hbs', 'utf8' ) ) | |
.then( modelstatic ) | |
.then( handlebars ) | |
.then( domappend ) | |
.then( function( data ) { | |
var model = data.model; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = MyClass; | |
function MyClass() { | |
var myPrivatVariable = 10; | |
return { | |
publicMethod: function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var rafLoop = require('raf-loop'); | |
var COUNT_PARTICLE = 100; | |
var MAX_VELOCITY = 5; | |
var FRICTION_MAGNITUDE = 0.07; | |
var els = array(COUNT_PARTICLE, createElement); | |
var positions = create(COUNT_PARTICLE, [window.innerWidth * 0.5, window.innerHeight * 0.5, 0]); | |
var velocities = create(COUNT_PARTICLE, [rand(-MAX_VELOCITY, MAX_VELOCITY), rand(-MAX_VELOCITY, MAX_VELOCITY), rand(-MAX_VELOCITY, MAX_VELOCITY)]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fill = require('lodash/array/fill'); | |
var arr = fill(new Array(10), function() { return 'test' }); | |
var arr2 = fill(new Array(10), 'test'); | |
document.body.innerHTML = JSON.stringify(arr) + JSON.stringify(arr2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cssTransformToMatrix = require('css-transform-to-mat4'); | |
var containerTest = document.createElement('div'); | |
document.body.style[ 'text-align' ] = 'right'; | |
document.body.style[ 'font-family' ] = 'Helvetica, sans serif'; | |
document.body.style.width = '100%'; | |
document.body.style.height = '100%'; | |
document.body.style.margin = '0'; | |
containerTest.style.height = window.innerHeight + 'px'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* To convert between typed arrays an ArrayBuffer can be used to create | |
* TypedArray's from one type to another. Each typed array has a property | |
* which is an ArrayBuffer. | |
**/ | |
var uint16 = new Uint16Array([0x0102, 0x0304]); | |
var uint32 = new Uint32Array(uint16.buffer); | |
var uint8clamped = new Uint8ClampedArray(uint16.buffer); | |
var uint8 = new Uint8Array(uint16.buffer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var red = 0xFF; // 255 | |
var green = 0x10; // 16 | |
var blue = 0xCC; // 204 | |
var alpha = 0xFF; | |
// 24 bit color (no alpha) | |
var color24 = red << 16 | green << 8 | blue; | |
// 32 bit color (alpha) | |
// note >>> 0 if this isn't done alpha overflows to negation bit |
OlderNewer