Skip to content

Instantly share code, notes, and snippets.

@gilesbutler
gilesbutler / alert-machine.js
Created May 28, 2020
Simple Alert machine for xState
View alert-machine.js
import { Machine, assign } from "xstate";
const initialState = {
alert: {},
};
export default Machine(
{
id: "alert",
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@gilesbutler
gilesbutler / index.js
Created Sep 18, 2019
gridsome source-datocms updates
View index.js
const { SiteClient, Loader } = require("datocms-client");
const { camelize } = require("humps");
const withNoEmptyValues = object => {
if (Object.prototype.toString.call(object) === "[object Object]") {
const result = {};
for (const [key, value] of Object.entries(object)) {
const valueWithNoEmptyValues = withNoEmptyValues(value);
if (valueWithNoEmptyValues) {
View gist:7852451
== CreateProducts: migrating =================================================
-- create_table(:products)
-> 0.0067s
== CreateProducts: migrated (0.0068s) ========================================
== DeviseCreateAdminUsers: migrating =========================================
-- create_table(:admin_users)
-> 0.0123s
-- add_index(:admin_users, :email, {:unique=>true})
-> 0.0066s
View gist:7640196
foreman run rake db:refresh
rake aborted!
You are using the old router DSL which has been removed in Rails 3.1. Please check how to update your routes file at: http://www.engineyard.com/blog/2010/the-lowdown-on-routes-in-rails-3/
/Users/gilesbutler/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.1/lib/action_dispatch/routing/route_set.rb:334:in `eval_block'
/Users/gilesbutler/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.1/lib/action_dispatch/routing/route_set.rb:319:in `draw'
/Users/gilesbutler/.rvm/gems/ruby-2.0.0-p247/gems/gitstats-0.0.2/config/routes.rb:1:in `<top (required)>'
/Users/gilesbutler/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:223:in `load'
/Users/gilesbutler/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:223:in `block in load'
/Users/gilesbutler/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:214:in `load_dependency'
/Users/gilesbutler/.rvm/gems/ruby-2.0.0-p247/gems/activesuppo