Skip to content

Instantly share code, notes, and snippets.

/**
* Somewhere in an app module, pull in the app specific translator
*/
import t from 'util/translate'
t("Edu_bs")
// => "Bachelor's"
/**
* Ref $elector Mixin
*/
export default {
$(ref) {
return this.refs[ref].getDOMNode()
}
}
let validActions = {
[GameConstants.GAME_CREATE]: null,
[GameConstants.GAME_JOIN]: null,
[GameConstants.GAME_EXIT]: null,
[GameConstants.USER_JOINED]: null,
[GameConstants.USER_LEFT]: null
}
GameDispatcher.register( ({actionType, data}) => {
if (actionType in validActions) {
@solomonhawk
solomonhawk / example.js
Last active August 29, 2015 14:16
EZ Store Listening
// some pieces of this file have been omitted
let React = require('react')
let notesStore = require('../../stores/notesStore')
let monitorMixin = require('../../mixins/monitorMixin')
let Notes = React.createClass({
mixins: [monitorMixin(notesStore)]
// this gets called whenever `notesStore` emits a change event
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => {
return [1, 2, 3];
@solomonhawk
solomonhawk / data.json
Last active August 29, 2015 14:12
Simple Object Sorting
{
"name": "Ashe's Pokedex",
"sort": "byName",
"order": "descending",
"pokemon": [
{
"id": 4,
"name": "Charmander",
"types": "fire",
"species": "lizard",
@solomonhawk
solomonhawk / gist:1628b1ce459bba3ad7f0
Last active August 29, 2015 14:11
return void callback()
function(callback) {
if (someCond) return void callback();
// do things
return "some value";
}