Instantly share code, notes, and snippets.

View _redux.ex
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
View _redux.ex
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
View edux.exs
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
View scram.py
# 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
View index.js
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.
View TRPA Rules of Procedure.md

TRPA Code of Ordinances

Rules of Procedure

Adopted November 15, 2011 Effective March 1, 2012

ARTICLE 1: GENERAL

1.1. PURPOSE OF RULES

View gist:b41a7e56e86917ded8194614918f572e
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
View gist:4dfde384648c271b1194d28e0bb86ee0
### 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:
View ben.rb
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