Skip to content

Instantly share code, notes, and snippets.

View moimikey's full-sized avatar
:shipit:
ship it

Michael Scott Hertzberg moimikey

:shipit:
ship it
View GitHub Profile
@therealklanni
therealklanni / accessors.md
Last active January 20, 2016 13:23
Demystifying Property Accessors

Examining the Object property accessor behavior

Consider the following scenario

function invert(color) {
  var lookup = {
    black: 'white',
    white: 'black'
 }
@ericelliott
ericelliott / react-reusable-component.md
Last active January 8, 2025 09:50
React - Complete Reusable Component

React Reusable Component Factory

'use strict';

const ENTER_KEY = 13;

const emailFactory = function ({
  React,
  setEmail,
@whatupdave
whatupdave / connectToStores.js
Last active August 29, 2015 14:21
connectToStores
import React from 'react'
export default function connectToStores(...stores) {
return function(Component) {
return class StoreConnection extends React.Component {
constructor(props) {
super(props)
this.state = Component.getPropsFromStores()
this.handleStoresChanged = this.handleStoresChanged.bind(this)
}
@rockymeza
rockymeza / makeDecorator.js
Created May 13, 2015 16:00
A function decorator to make function decorators
// Based on idea from @nolsto
function makeDecorator(decorator) {
return function(target, key, descriptor) {
if (typeof descriptor !== 'undefined') {
descriptor.value = decorator(descriptor.value);
return descriptor
} else {
return decorator(target);
}
@gaearon
gaearon / react-dnd-1.0-alpha-example.js
Last active August 29, 2015 14:19
React DnD 1.0 alpha example
import React from 'react';
import { configureDragDrop, configureDragDropContext } from 'react-dnd';
import HTML5Backend from 'react-dnd/modules/backends/HTML5';
// Note: @configureDragDropContext is called a “decorator”.
// This desugars roughly as class App { ... } App = configureDragDropContext(HTML5Backend)(App);
// You can enable decorators by putting { "stage": 1 } in your .babelrc.
@configureDragDropContext(HTML5Backend)
export default class App extends React.Component {
@mattmccray
mattmccray / ReactTools.js
Created April 19, 2015 21:32
ES7 decorators for React component classes
export const Types= React.PropTypes
// These functions are meant for use with ES7 decorators... (use babel!)
export function ContextTypes( contextTypes={}) {
return function( component) {
return _setOrExtend( component, 'contextTypes', contextTypes)
}
}
@maximilianschmitt
maximilianschmitt / readme.md
Last active August 29, 2015 14:19
Making your io.js command line apps compatible with node.js
@fasterthanlime
fasterthanlime / csview.sh
Last active November 14, 2015 19:45
If you need a quick CSV viewer
#!/bin/sh
sed 's/,,/, ,/g;s/,,/, ,/g' | column -s, -t | vim +"set nowrap" -
@paulirish
paulirish / bling.js
Last active July 23, 2025 07:08
bling dot js
/* bling.js */
window.$ = document.querySelector.bind(document);
window.$$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function(name, fn) { this.addEventListener(name, fn); };
NodeList.prototype.__proto__ = Array.prototype;
NodeList.prototype.on = function(name, fn) { this.forEach((elem) => elem.on(name, fn)); };
@wchan2
wchan2 / .gitignore
Last active August 11, 2024 20:13
JavaScript Prototypal Inheritance Exercise
npm-debug.log
node_modules