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
@erichulburd
erichulburd / gist:0599a93e36380aaed7c9
Created December 5, 2014 19:29
User Model Migrations for Rails Devise with login attribue
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:authentication_keys => [:login]
attr_accessor :login
# ...
// databasable.js
import Loki from 'lokijs/src/lokijs';
import LokiIndexedAdapter from 'lokijs/src/loki-indexed-adapter';
const DEFAULTS = {
autosave: false
};
var databasable = {
@erichulburd
erichulburd / products.reducer.js
Created August 15, 2016 21:03
Make sure to return Immutable objects in reducers
[ensureProducts]: (products_data, token)=>{
if (products_data === null){
return loop(
products_data,
Effects.promise(()=>{
let api = new ProductsApi(token);
return api.index()
.then(productsRetrieved)
})
)
@erichulburd
erichulburd / routes.js
Last active September 29, 2016 16:04
configuracion de rutas sin clases
import Route from './route';
export function defineRoutes(i18n) {
let routes = [
{
name: 'Home',
path: new RegExp('^\/?((\\w{2})\/?)?$'),
parameters: {2: 'locale'}
}, {
name: 'Dashboard',
path: new RegExp(`^\/?((\\w{2})\/?)?${i18n.t('dashboard')}$`),
@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;
}
@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 -->
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'}

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:

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));