Skip to content

Instantly share code, notes, and snippets.

View erichulburd's full-sized avatar

Eric Hulburd erichulburd

  • Rigetti Computing
  • Berkeley, CA
View GitHub Profile
const applyForce = (action$, store) =>
action$.ofType(actions.APPLY_FORCE_CLICK)
.throttleTime(100)
// Do not apply force unless game is ongoing.
.filter(_action => selectors.isGameOngoing(store.getState()))
.map(action => actions.applyForce(action.payload));
const game = (action$, store) =>
action$.ofType(actions.START_CLICK)
// Do not start game if it is already ongoing.
const game = (action$, store) =>
action$.ofType(actions.START)
.mergeMap(() => {
const interval = Observable.interval(250)
.takeUntil(action$.ofType(
actions.PAUSE,
actions.RESET,
actions.END
));
const incrementTime = interval
const game = (action$, store) =>
action$.ofType(actions.START)
.mergeMap(() => {
const interval = Observable.interval(250)
.takeUntil(action$.ofType(
actions.PAUSE,
actions.RESET,
actions.END
));
});
const game = (action$, store) =>
action$.ofType(actions.START)
.mergeMap(() =>
Observable
.interval(250)
// ...
);
const applyForce = (action$, _store) =>
action$.ofType(actions.APPLY_FORCE_CLICK)
.throttleTime(100)
// Where payload here would be the index of the ball that the user is applying force on.
.map(action => actions.applyForce(action.payload));

Keybase proof

I hereby claim:

  • I am erichulburd on github.
  • I am erichulburd (https://keybase.io/erichulburd) on keybase.
  • I have a public key ASB59L_ZFIs_yV9MGQdr6oRlHCq7Lw5XalGdIclR4Xwpkgo

To claim this, I am signing this object:

import React from 'react';
import styles from './styles.scss';
import classnames from 'classnames';
/**
* Button params:
* size: {'xs', 'sm', 'md', 'lg'}
* rounded: {true, false}
* color = {'gray', 'red','blue','green'}
* weight = {'xtralight', 'light', 'normal', 'bold'}
@erichulburd
erichulburd / autofill.html
Created October 13, 2016 21:51
Autofill Safe
<!-- current component -->
<input type="email"
name="email"
class="form-control"
placeholder="Email Address"
value="{this.login.email}"
onChange="{this.loginFieldChanged.bind(this)}"
required/>
<!-- refactored component -->
@erichulburd
erichulburd / route.js
Created September 29, 2016 23:37
Spike Route class
import * as S from 'underscore.string';
import queryString from 'query-string';
export default class Route {
constructor(route_definition){
let route = this;
route.params = {};
route.data = route_definition;
}