defimpl Poison.Encoder, for: Usic.User do
@attributes ~W(id email inserted_at updated_at)a
def encode(song, _options) do
song
|> Map.take(@attributes)
|> Poison.encode!
end
end
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys | |
import json | |
""" | |
cat ldjson-thing | ldjson msg,time | |
""" | |
def pick(row, path, label = ''): | |
if len(path) == 1: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Foo do | |
def to_strings(m) when is_map(m) do | |
m | |
|> Enum.map(fn | |
{k, v} when is_integer(k) -> {Integer.to_string(k), to_strings(v)} | |
{k, v} -> {k, to_strings(v)} | |
end) | |
|> Enum.into(%{}) | |
end | |
def to_strings(a_list) when is_list(a_list) do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib3 | |
from urlparse import urlparse | |
import os | |
import json | |
from urllib import urlencode | |
from time import sleep | |
import pprint | |
import argparse | |
import sys |
We can't make this file beautiful and searchable because it's too large.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Police Beat,CRIME_TYPE,CRIME_DESCRIPTION,STAT_VALUE,REPORT_DATE,Sector,Precinct,Row_Value_ID | |
B1,Homicide,Homicide,0,01/01/2008,B,N,1 | |
B1,Rape,Rape,0,01/01/2008,B,N,2 | |
B1,Robbery,Robbery,5,01/01/2008,B,N,3 | |
B1,Assault,Assault,1,01/01/2008,B,N,4 | |
B1,Larceny-Theft,Larceny-Theft,35,01/01/2008,B,N,5 | |
B1,Motor Vehicle Theft,"Vehicle Theft is theft of a car, truck, motorcycle or any motor vehicle.",4,01/01/2008,B,N,6 | |
B1,Burglary,Burglary,15,01/01/2008,B,N,7 | |
B2,Homicide,Homicide,0,01/01/2008,B,N,8 | |
B2,Rape,Rape,0,01/01/2008,B,N,9 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EQUIP_ID | YEAR | MAKE | MODEL | COLOR | DESCRIPTION | AUCTION HOUSE | COMMENTS | |
---|---|---|---|---|---|---|---|---|
12909 | 2001 | GMC | SAFARI | WHITE | PASSENGER MINIVAN | BIDADOO ONLINE AUCTION | ||
31479 | 2010 | FORD | CROWN VICTORIA | BLUE/WHITE | PATROL CAR | MURPHYS AUCTION | ||
31480 | 2010 | FORD | CROWN VICTORIA | BLUE/WHITE | PATROL CAR | BIDADOO ONLINE AUCTION | ||
31485 | 2010 | FORD | CROWN VICTORIA | BLUE/WHITE | PATROL CAR | BIDADOO ONLINE AUCTION | ||
31489 | 2010 | FORD | CROWN VICTORIA | BLUE/WHITE | PATROL CAR | BIDADOO ONLINE AUCTION | ||
31490 | 2010 | FORD | CROWN VICTORIA | BLUE/WHITE | PATROL CAR | MURPHYS AUCTION | ||
31493 | 2010 | FORD | CROWN VICTORIA | BLUE/WHITE | PATROL CAR | BIDADOO ONLINE AUCTION | ||
31494 | 2010 | FORD | CROWN VICTORIA | BLUE/WHITE | PATROL CAR | BIDADOO ONLINE AUCTION | ||
31498 | 2010 | FORD | CROWN VICTORIA | BLUE/WHITE | PATROL CAR - DUI | MURPHYS AUCTION | TOTALED (4/2016) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foo | bar | |
---|---|---|
1 | 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule KVStore do | |
use GenServer | |
# This executes within the supervisor or whoever starts the KVStore | |
def start_link do | |
# First arg is the callback module (this module) | |
# The name arg registers the process globally as `KVStore`, essentially making it a singleton | |
GenServer.start_link(KVStore, [], name: KVStore) | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
00:47:26.460 [error] GenServer #PID<0.276.0> terminating | |
** (Poison.EncodeError) unable to encode value: {nil, "user"} | |
(poison) lib/poison/encoder.ex:339: Poison.Encoder.Any.encode/2 | |
(poison) lib/poison/encoder.ex:213: anonymous fn/4 in Poison.Encoder.Map.encode/3 | |
(poison) lib/poison/encoder.ex:214: Poison.Encoder.Map."-encode/3-lists^foldl/2-0-"/3 | |
(poison) lib/poison/encoder.ex:214: Poison.Encoder.Map.encode/3 | |
(poison) lib/poison/encoder.ex:213: anonymous fn/4 in Poison.Encoder.Map.encode/3 | |
(poison) lib/poison/encoder.ex:214: Poison.Encoder.Map."-encode/3-lists^foldl/2-0-"/3 | |
(poison) lib/poison/encoder.ex:214: Poison.Encoder.Map.encode/3 | |
(poison) lib/poison/encoder.ex:213: anonymous fn/4 in Poison.Encoder.Map.encode/3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def(at(<<var!(head) :: binary - size(2), rest :: binary>>, ptr, meta) when ptr >= 8 and ptr <= 9) do | |
new_posn = ptr + 2 | |
case({:meta, {:header_length, head}}) do | |
{:halt, _} = halt -> | |
halt | |
{:meta, {key, val}} -> | |
{rest, new_posn, Dict.put(meta, key, val), []} | |
result -> | |
{rest, new_posn, meta, [result]} | |
end |