Skip to content

Instantly share code, notes, and snippets.

-module(error_m).
-export([return/1, fail/1, bind/2]).
return(V) -> {ok, V}.
fail(V) -> {error, V}.
bind({ok, V}, F) -> F(V);
bind(Err={error, _}, _F) -> Err.
$ python test_context.py
CONTEXT: start
USER: got resource
CONTEXT: done
Traceback (most recent call last):
File "test_context.py", line 32, in <module>
for i in user():
File "test_context.py", line 27, in user
for item in resource:
TypeError: iter() returned non-iterator of type 'MyIterator'
@ericmoritz
ericmoritz / stories-views.py
Created June 4, 2012 21:14 — forked from cwmanning/stories-views.py
story view messing with asset parsing
from django.conf import settings
from django.http import HttpResponse
from django.shortcuts import render
from dummyjson import views as dj
from ordereddict import OrderedDict
import json
def story(request, content_id, slug=None, template=None):
path = '/static/content/modules/stories/story_' + content_id + '.json'
if not template:
@ericmoritz
ericmoritz / bbeat.clj
Created March 2, 2012 16:09 — forked from damionjunk/gist:1500336
Binaural Beats with Overtone and Clojure
(ns overtone-clj-toys.binaural
(:use [overtone.live]))
;;
;; Binaural Beat Synthesis:
;; Generates binaural beats given the provided carrier and desired
;; frequency. Brown noise is used to soften the background and
;; block out outside noise.
;; freq effect