Skip to content

Instantly share code, notes, and snippets.

View typesend's full-sized avatar

Ben Damman typesend

View GitHub Profile
@typesend
typesend / _redux.ex
Created January 15, 2018 04:34 — forked from rstacruz/_redux.ex
Redux.ex (elixir)
defmodule Redux do
@moduledoc """
Like redux.js, but more elixir-like
store = create_store fn state, action -> ... end
store |> get_state()
store |> dispatch(%{ type: "publish" })
"""
defstruct reducer: nil, state: nil
defmodule Store do
@initializer_action %{type: "@@INIT"}
# Code your Mom calls
def start_link(reducer, initial_state \\ nil) do
GenServer.start_link(__MODULE__, [reducer, initial_state])
end
def get_state(store) do
@typesend
typesend / scram.py
Created October 7, 2017 08:10
Skeleton for naively pumping messages into and out of MQ using a simple loop.
# pip install redis
# pip install hiredis
# pip install python-dotenv
import os
from os.path import join, dirname
from dotenv import load_dotenv
import redis
import json
import time
@typesend
typesend / index.js
Created September 28, 2017 16:06
Initial Oscar Schema
var express = require('express');
var graphqlHTTP = require('express-graphql');
// var GraphQLJSON = require('graphql-type-json');
var { buildSchema } = require('graphql');
var schema = buildSchema(`
# Temporary placeholder type for development.
scalar TBD
# A JSON Web Token string.
@typesend
typesend / TRPA Rules of Procedure.md
Last active September 25, 2017 02:10
Manually converted the TRPA Rules of Procedure PDF into Markdown.

TRPA Code of Ordinances

Rules of Procedure

Adopted November 15, 2011 Effective March 1, 2012

ARTICLE 1: GENERAL

1.1. PURPOSE OF RULES

https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsupport.hp.com%2Fus-en%2Fdrivers%2Fselfservice%2Fswdetails%2Fhp-l7014t-14-inch-retail-touch-monitor%2F10691869%2FswItemId%2Fvc-170706-1&data=02%7C01%7Cben.damman%40state.ca.gov%7C5ce2c3e2a8564bbddd3108d4d45f5d72%7C52b26be47f5d4e1cbaed8cf75b7570d5%7C1%7C0%7C636366953441362889&sdata=rWJ1t6HVIjYMLCmANBuXb67LMrtr9otQyF11ViYtl5E%3D&reserved=0
### Keybase proof
I hereby claim:
* I am typesend on github.
* I am typesend (https://keybase.io/typesend) on keybase.
* I have a public key whose fingerprint is 38B6 37EC 2568 54C4 2AD5 FCF1 0A5D DBE0 F1D9 C113
To claim this, I am signing this object:
def self.import(file)
CSV.foreach(file.path, headers: true) do |row|
house = find_or_initialize_by(id: row['business_id']) # needed to specify what column to use when finding it
# Explicit mappings is important for maintainability and so it's clear what columns you expect.
house.attributes = {
address: row['address'],
whatever: row['what_ever'],
blah: row['blah_column']
}
# this overwrites all data of any pre-existing records, too, which is probably a bad idea

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style