Skip to content

Instantly share code, notes, and snippets.

{
"queries": [
{
"href" : "http://example.org/apollo/v1/merged-fronts/",
"prompt" : "Get a merged front",
"data" : [
{"name": "front", "prompt": "Front slug, may be repeated"},
{"name": "page", "prompt": "The page number"},
{"name": "count", "prompt": "The items per page"}
]
{"collection": {
"items": [
{
"href": "http://example.com/modules/1",
"data": [
{"name": "title", "value": "Module"}
],
"links": []
},
{
@ericmoritz
ericmoritz / 2013.txt
Last active December 31, 2015 21:49
Comparison between Pitchfork's top 50 rankings and ranking by rating on the original review.
10.0 Nirvana - In Utero: 20th Anniversary Edition http://pitchfork.com/reviews/albums/18517-nirvana-in-utero-20th-anniversary-edition/
10.0 Fleetwood Mac - Rumours http://pitchfork.com/reviews/albums/17499-rumours/
10.0 Nas - Illmatic http://pitchfork.com/reviews/albums/17497-illmatic/
10.0 J Dilla - Donuts (45 Box Set) http://pitchfork.com/reviews/albums/17510-donuts-45-box-set/
9.5 Kanye West - Yeezus http://pitchfork.com/reviews/albums/18172-kanye-west-yeezus/
9.3 Vampire Weekend - Modern Vampires of the City http://pitchfork.com/reviews/albums/17963-vampire-weekend-modern-vampires-of-the-city/
9.2 Various Artists - The Rise & Fall of Paramount Records, Volume One (1917-1932) http://pitchfork.com/reviews/albums/18703-the-rise-fall-of-paramount-records-volume-one-1917-1932/
9.2 Arcade Fire - Reflektor http://pitchfork.com/reviews/albums/18667-arcade-fire-reflektor/
9.2 Digable Planets - Blowout Comb http://pitchfork.com/reviews/albums/18154-digable-planets-blowout-comb/
9.2 Half Japanese - ½ Gentlemen / Not
@ericmoritz
ericmoritz / x.py
Last active December 31, 2015 06:19
from fp.collections import get_nested
from fp.monads.maybe import Maybe
metadata = Maybe.catch(lambda: json.loads(json_src)).default({})
@ericmoritz
ericmoritz / collection+protobuf.md
Last active December 30, 2015 10:19
A prototype of collection+protobuf
def modify_cache(cache, key, timeout, callback):
"""
A abstraction from the common, cache.get, if None, cache.set pattern.
Test an uncached value:
>>> cache = __mock_cache(None)
>>> modify_cache(cache, 'foo', 1000, lambda: 1)
1
>>> cache.get.assert_called_with('foo')
>>> cache.set.assert_called_with('foo', 1, 1000)
function arraySum(i) {
return i.reduce(function(sum, x) {
if(x.reduce) {
return sum + arraySum(x);
} else if (typeof x === "number") {
return sum + x;
} else {
return sum;
}
}, 0);
@ericmoritz
ericmoritz / .gitignore
Last active December 23, 2015 18:19
A simple protobuf based web service
*.pyc
*~
.env/
static/
data/
*_pb2.py
{-# LANGUAGE TemplateHaskell #-}
module MMURL (encodeURL, decodeURL, setActions, actions) where
import Text.Parsec.Prim
import Text.Parsec.Error
import Text.ParserCombinators.Parsec.Char
import Text.ParserCombinators.Parsec.Combinator
import Data.HMAC
import Data.Char (ord)
import Codec.Utils (Octet)
function maybe(x) {
return {
bind: function(f) {
if(x == null) {
return null;
} else {
return f(x);
}
},
getDefault: function(y) {