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
// Lets you call classSet with strings *and* objects | |
// Usage: classSet({a: true, b: false}, 'class1', null, 'class2'); class="a class1 class2" | |
function classSet() { | |
var classes = [], | |
arg, x, key; | |
for( x = 0; x < arguments.length; x++ ) { | |
arg = arguments[ x ]; | |
if( typeof arg === 'object' ) { |
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
componentDidMount: function() { | |
UserStore.on( 'change', this.onStoreChange ); | |
}, | |
componentWillUnmount: function() { | |
UserStore.off( 'change', this.onStoreChange ); |
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 csv = require('csv'); | |
csv.parse(fs.readFileSync('./csv_with_headers.csv'), function(err, data) { | |
// Store the headers row | |
var headers = data[0]; | |
// Remove the headers row | |
data.shift(); | |
var objects = _.map(data, function(csvRow) { |
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
LINE 1: ...T JOIN likes ON shaders"."id = likes"."shader_id" where "pub... | |
^ |
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
}).catch(function( error ) { | |
var errorPosition = Number(error.position), | |
msg = error.toString(), | |
query = msg.replace(/^.+: | - .+?$/g, ''), | |
sqlMsg = msg.replace(/^.+ - /g, ''), | |
context = 50, | |
leftTruncate = Math.max( errorPosition - context, 0 ); | |
console.error( query + ';' ); | |
console.error( error.severity + ': ' + sqlMsg ); |
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
/** | |
* What is it: | |
* Require an image relative to a base image folder and include @2x if it's a retina screen. | |
* Works with webpack and only requires one image path (as opposed to react-retina-image, | |
* which requires specifying both regular and @2x paths). Depends on npm package 'is-retina' | |
* and node's 'path' | |
* Usage: | |
* import requireRetina from './require_retina.js'; // this file | |
* <img src={requireRetina('your_image.png')} /> | |
*/ |
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
let entities = { | |
\' ': { 'entity': ' ', 'number': ' ', 'description': 'Space' } | |
} |
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
setInterval(function() { | |
Array.prototype.slice.call(document.querySelectorAll('[data-reactid]')).forEach(function(element) { | |
element.style.background = 'rgba(255,0,0,0.1)'; | |
}); | |
}, 500); |
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
hasParent( child, parent ) { | |
let node = child.parentNode; | |
while( node != null ) { | |
if( node === parent ) { | |
return true; | |
} | |
node = node.parentNode; | |
} | |
return false; | |
} |
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
/* vertex */ | |
uniform mat4 modelMatrix; | |
varying mat4 matrix; | |
... | |
void main() { | |
vPosition = position; | |
matrix = modelMatrix; | |
/* fragment */ |