I hereby claim:
- I am dwickstrom on github.
- I am dwickstrom (https://keybase.io/dwickstrom) on keybase.
- I have a public key ASC9XLlpE9HjjPKrx6xLsiUrus-PsONoWrT4wmmJass3qwo
To claim this, I am signing this object:
{% for block in self.body %} | |
<section class="{{ block.block_type }}"> | |
{% if block.block_type == 'fooblock' %} | |
{% get_foo block.value request %} | |
{% else %} | |
{{ block}} | |
{% endif %} | |
</section> | |
{% endfor %} |
;[true, true, false].every(id => id) // false | |
;[true, true, true].reduce((x, y) => x && y) // true |
import inspect | |
def fmap(f, functor): | |
def _dict_map(f, functor): | |
result = {} | |
for key, value in functor.items(): | |
result[key] = f(value) | |
return result | |
def _object_map(f, functor): |
# filter_by :: [Kwarg] -> lambda QuerySet | |
def filter_by(**kwargs): | |
return lambda qs: qs.filter(**kwargs) | |
# filter_by_type :: QuerySet -> QuerySet | |
filter_by_type = lambda x: filter_by(type=x) | |
# filter_by_project :: QuerySet -> QuerySet |
import functools | |
def compose(*functions): | |
return functools.reduce(lambda f, g: lambda x: f(g(x)), functions, lambda x: x) | |
def curry(fn): | |
def curried(*args, **kwargs): | |
if len(args) + len(kwargs) >= fn.__code__.co_argcount: | |
return fn(*args, **kwargs) |
@curry | |
def safe_cast(to_type, value): | |
try: | |
return Just.of(to_type(value)) | |
except: | |
return Nothing | |
to_float = safe_cast(float) | |
to_int = safe_cast(int) | |
to_str = safe_cast(str) |
# get_fields :: Model -> [Field] | |
def get_fields(model): | |
return model._meta.get_fields() | |
# get_field :: String -> Model -> Field | |
@curry | |
def get_field(name, model): | |
return model._meta.get_field(name) |
docker rmi $(docker images -qa -f 'dangling=true') |
I hereby claim:
To claim this, I am signing this object:
// take :: Int -> [a] -> [a] | |
const take = n => ([x, ...xs]) => | |
!x ? | |
[] : | |
n === 0 ? | |
[] : | |
[x, ...take (n-1) (xs)] |