Skip to content

Instantly share code, notes, and snippets.

@Rubentxu
Rubentxu / maybe.go
Created Sep 24, 2015
Implementing the Maybe monad in Golang
View maybe.go
package main
import (
"fmt"
"errors"
)
type Maybe interface {
Return(value interface{}) Maybe
Bind(func(interface{}) Maybe) Maybe
@signed0
signed0 / gist:2252148
Created Mar 30, 2012
Douglas Peucker
View gist:2252148
from math import sqrt
from itertools import islice, chain
def subtract_coords(a, b):
'''Returns a - b'''
return (a[0] - b[0], a[1] - b[1])
def dot_product(a, b):
return a[0] * b[0] + a[1] * b[1]
@signed0
signed0 / gist:1731010
Created Feb 3, 2012
Lazy loding method decorator
View gist:1731010
''''
From http://code.activestate.com/recipes/363602-lazy-property-evaluation/
Usage:
class MyClass():
@lazyloaded
def config(self):
return {'yay': 'nay'}
You can’t perform that action at this time.