Skip to content

Instantly share code, notes, and snippets.

var EventEmitter = require('events').EventEmitter;
var mergeInto = require('react/lib/mergeInto');
module.exports = createStore;
function createStore(initialState) {
var events = new EventEmitter();
var state = initialState || {};
return {
@ryanflorence
ryanflorence / natives.js
Created January 15, 2011 06:09
Experimental extending of native objects without touching prototypes
;(function(){
function typeOf(item){
if (item._family) return item._family();
return typeof item;
}
Array.prototype._family = function(){ return 'array'; };
var _ = this._ = function(obj){
@mocheng
mocheng / algorithm.php
Created February 17, 2011 06:44 — forked from ryanflorence/algorithm.php
Solution and forked from https://gist.github.com/830201
<?php
$arr = array(
'Color' => array('Red', 'Blue'),
'Size' => array('Regular', 'Large'),
'Material' => array('Metalic', 'Nylon')
);
function magic_algorithm($arr){
function cartesian_product($arrays) {
@ryanflorence
ryanflorence / pubsub.js
Created October 14, 2011 22:47
Simple Pub/Sub
!function () {
var channels = {};
this.subscribe = function (channel, subscription) {
if (!channels[channel]) channels[channel] = [];
channels[channel].push(subscription);
};
this.publish = function (channel) {
if (!channels[channel]) return;
@ryanflorence
ryanflorence / gerrit
Created October 19, 2011 17:34
Open gerrit commit
#!/bin/bash
open "https://gerrit.instructure.com/#q,$(git log --grep='^Change-Id: ' -1|\
grep 'Change-Id: '|head -n 1|sed 's/Change-Id://'|sed 's/ //g'),n,z"
@ryanflorence
ryanflorence / jshint-and-vim.md
Created November 2, 2011 18:29
Get jshint running on write (save) with VIM
  1. Download [jshint.vim][jshint]

  2. Put it in ~/.vim/plugin/jshint.vim

  3. Edit your local vimrc file (I'm on macvim with janus, so it's at ~/.gvimrc.local) and add:

    au BufWritePost *.js :JSHint
  4. Read the [vim docs][vim] and particularly [auto commands][auto] I'm a newb and the neckbeards are probably laughing at me for even posting this.

@ryanflorence
ryanflorence / LICENSE.txt
Created November 9, 2011 15:09 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@ryanflorence
ryanflorence / christmas.vim
Created November 29, 2011 20:48
Christmas color scheme for Vim
" ------------------------------------------------------------------
" Filename: christmas.vim
" Last Modified: Nov, 29 2011
" Version: 1
" Maintainer: Nobody, jacked from SM Smithfield (m_smithfield AT yahoo DOT com)'s Marklar
" Copyright: 2006 SM Smithfield
" This script is free software; you can redistribute it and/or
" modify it under the terms of the GNU General Public License as
" published by the Free Software Foundation; either version 2 of
" the License, or (at your option) any later version.
@linjunpop
linjunpop / README.md
Last active December 23, 2015 15:49
iOS 7 Safari Notes

CSS font values

-apple-system-headline1
-apple-system-headline2
-apple-system-body
-apple-system-subheadline1
-apple-system-subheadline2
-apple-system-footnote
-apple-system-caption1
var get = Ember.get, set = Ember.set, doc = document;
var FastSelectComponent = Ember.Component.extend({
items: null,
valuePath: 'value',
labelPath: 'label',
value: null,
selected: null,
tagName: 'select',