Skip to content

Instantly share code, notes, and snippets.

View mbriggs's full-sized avatar

Matt Briggs mbriggs

View GitHub Profile
@mbriggs
mbriggs / fixture.rb
Created December 12, 2018 23:55
Take 2 on handler fixtures
require_relative "../../automated_init"
context "Handle Commands" do
context "Added" do
context "Writes Added event" do
id = Controls::Account.id
account = Controls::Account::New.example
add = Controls::Commands::Add.example
time = Controls::Time::Processed.example
@mbriggs
mbriggs / event_written.rb
Created September 3, 2018 18:27
Fixtures
module Fixtures
class EventWritten
include TestBench::Fixture
attr_accessor :stream_name
attr_accessor :values
attr_accessor :command
attr_accessor :expected_version
attr_accessor :command_attributes
@mbriggs
mbriggs / redis.ex
Created April 12, 2016 03:08
redis client
defmodule Autobot.Redis do
import Exredis
def start_link do
Agent.start_link(fn ->
{:ok, client} = Exredis.start_link
client
end, name: __MODULE__)
end
@mbriggs
mbriggs / anonymous-gist.js
Created January 17, 2016 00:52
production webpack config
var webpack = require('webpack');
var path = require('path');
var ManifestPlugin = require('webpack-manifest-plugin')
function root(fragment){
return path.join(__dirname, "client", fragment);
}
module.exports = {
devtool: 'source-map',
@mbriggs
mbriggs / anonymous-gist.rb
Created January 17, 2016 00:51
my rails helper for webpack dev server, and compiled into public
def include_js(file)
@_js_includes ||= {}
@_js_includes[file] ||= begin
manifest_path = Rails.root.join('public', 'assets', 'manifest.json')
if File.exist?(manifest_path)
manifest = JSON.parse(File.read(manifest_path))
path = "/assets/#{manifest[file]}"
else
path = "http://127.0.0.1:8080/#{file}"
@mbriggs
mbriggs / add_to_globals.py
Last active August 29, 2015 14:21
add to globals
import sublime
import sublime_plugin
import re
"""
___ __ __ __ ________ __ __
/ | ____/ /___/ / / /_____ / ____/ /___ / /_ ____ _/ /____
/ /| |/ __ / __ / / __/ __ \ / / __/ / __ \/ __ \/ __ `/ / ___/
/ ___ / /_/ / /_/ / / /_/ /_/ / / /_/ / / /_/ / /_/ / /_/ / (__ )
/_/ |_\__,_/\__,_/ \__/\____/ \____/_/\____/_.___/\__,_/_/____/

Probably needs to be seed tables

spree_zones
spree_zone_members
spree_wrap_surface_aspect_ratios
spree_trackers
spree_tax_rates
spree_tax_categories
spree_styles
spree_states
let g:gist_clip_command = 'pbcopy'
let g:gist_detect_filetype = 1
@mbriggs
mbriggs / anonymous-gist.clj
Created September 18, 2014 20:14
websockets with core.async and http-kit
(defn build-routes
[{:keys [bus queues] :as app-data}]
(routes
(GET "/data" req
; get an http-kit websocket channel for this request
(http/with-channel req req-ch
; make a channel for subscriptions to the data updated event bus
(let [metrics (async/chan)]
; subscribed to all messages in the updated topic
(async/sub bus :updated metrics)
(defn- deref2 [_ p] @p)
(defn gather!
[{:keys [queues]}]
(send queues deref2 (rabbit/get-queues)))