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
var AnimationRegion = Backbone.Marionette.Region.extend({
innerRegionSelector: '.inner-page-region',
setLayout: function(layout, animationClass) {
this.regionAnimationClass = animationClass;
if (this.currentLayout) {
this.swap(layout);
} else {
@rwaldron
rwaldron / exponentiation.md
Last active August 29, 2015 14:01
Exponentiation Operator: **

Exponentiation Operator

Performs exponential calculation on operands. Same algorithm as Math.pow(x, y)

  • Commonly used in albegra, geometry, physics and robotics.
  • Nice to have "inline" operator

Prior Art

  • Python
@chenglou
chenglou / FRP.js
Last active August 29, 2015 14:01
React vanilla vs React + FRP drag
var App2 = React.createClass({
getInitialState: function() {
return {
x: 0,
y: 0
};
},
componentDidMount: function() {
var rect = this.refs.rect.getDOMNode();
@arnemart
arnemart / gist:c26aeddcb7d719b45529
Last active August 29, 2015 14:05
Cursors example
var React = require('react');
var Immutable = require('immutable-with-cursors');
var mainComponent = React.createClass({
getInitialState: function() {
return this.props;
},
render: function() {
return React.DOM.ul(
null,
@jergason
jergason / app.jsx
Created October 29, 2014 21:08
cursors woooo
var React = require('react');
var History = require('immutable-history');
// call `render` whenever the cursor changes
var state = new History({posts: [], username: 'Jamitron The Terrible'}, render);
var App = React.createClass({
render: function() {
var postsCursor = this.props.data.cursor(['posts']);
return <div>
@hekike
hekike / README.md
Created October 30, 2014 20:02
KOA + React = Isomorphic
'use strict';
var AppDispatcher = require('../dispatcher/AppDispatcher'),
ActionTypes = require('../constants/ActionTypes'),
ScreenSizes = require('../constants/ScreenSizes'),
{ createStore } = require('../utils/StoreUtils');
function getScreenSize() {
if (window.matchMedia('(min-width: 100em)').matches) {
return ScreenSizes.EXTRA_LARGE;
'use strict';
var ScreenSizeStore = require('../stores/ScreenSizeStore');
var ScreenSizeMixin = {
getInitialState() {
return this.getScreenSizeState();
},
getScreenSize() {
@gaearon
gaearon / getSupportedTransformProperty.js
Created January 27, 2015 19:45
getSupportedTransformProperty.js
'use strict';
var TRANSFORM_VARIANTS = {
'WebkitTransform': '-webkit-transform',
'Transform': 'transform'
};
function test() {
var testEl = document.createElement('div'),
style = testEl.style;
@max-mapper
max-mapper / index.js
Created March 1, 2015 23:54
csv parsing + transform pipeline
var csv = require('csv-parser')
var through = require('through2')
var ndjson = require('ndjson')
var fs = require('fs')
fs.createReadStream(process.argv[2])
.pipe(csv())
.pipe(through.obj(map))
.pipe(ndjson.serialize())
.pipe(process.stdout)