Skip to content

Instantly share code, notes, and snippets.

@nite
nite / curry.py
Last active May 29, 2017 21:36
A simple curry function in python
def curry(func):
def f(*args):
outerArgs = args
next = lambda *args : f(*args, *outerArgs)
next.value = lambda: func(args)
return next
return f
add = curry(sum)
@nite
nite / debounce.R
Last active March 23, 2017 17:10
# from https://gist.github.com/jcheng5/6141ea7066e62cafb31c
# Returns a reactive that debounces the given expression by the given time in
# milliseconds.
#
# This is not a true debounce in that it will not prevent \code{expr} from being
# called many times (in fact it may be called more times than usual), but
# rather, the reactive invalidation signal that is produced by expr is debounced
# instead. This means that this function should be used when \code{expr} is
# cheap but the things it will trigger (outputs and reactives that use
# \code{expr}) are expensive.