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 / 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 / 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)
})
)
// databasable.js
import Loki from 'lokijs/src/lokijs';
import LokiIndexedAdapter from 'lokijs/src/loki-indexed-adapter';
const DEFAULTS = {
autosave: false
};
var databasable = {
@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
# ...