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 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
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
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
//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
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
//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 ); |
NewerOlder