I hereby claim:
- I am ezku on github.
- I am ezku (https://keybase.io/ezku) on keybase.
- I have a public key ASDy2aowNRmtQBlM_34asQZcy6dnriZOfkHKS6tv81Fp_wo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
install: | |
brew install jq || brew upgrade jq |
I hereby claim:
To claim this, I am signing this object:
local ret_status="%(?:%{$fg_bold[green]%}λ :%{$fg_bold[red]%}λ %s)" | |
PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' | |
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" |
package fpinscala.datastructures | |
import org.scalacheck._ | |
import Arbitrary._ | |
import Gen._ | |
import Prop._ | |
object ListSpec extends Properties("list") { | |
property("length increases by one when adding an element") = forAll { (l: List[Int], a: Int) => | |
List.length(Cons(a, l)) == (List.length(l) + 1) |
# At every working directory change, if there's a Godeps file then run gvp | |
function switch_godeps() { | |
if [[ -e "Godeps" ]] | |
then | |
source gvp | |
fi | |
} | |
chpwd_functions=(${chpwd_functions[@]} "switch_godeps") |
Consider doing a bunch of HTTP requests.
doRequest('POST', 'api.example.com/foos', foos)
doRequest('POST', 'api.examples.com/bars', bars)
You find you'd like to avoid repeating the POST part, or maybe just bring the concept of a POST request as a first-class entity that can be passed around. Thinking in terms of classes and objects, you might be inclined to do this.
class Requester
constructor: (@method) ->
doRequest: (args...) ->
# See: https://github.com/fantasyland/fantasy-land#comonad | |
# data Store b a = Store b (b -> a) | |
# instance Comonad (Store b) | |
class Store | |
# { value: b, set: (b -> a) } -> Store b a | |
constructor: ({@value, @set}) -> | |
# () -> b |
class Thunk extends Promise | |
evaluated: false | |
constructor: (resolver) -> | |
deferred = Promise.defer() | |
@eval = -> | |
new Promise(resolver).then( | |
deferred.resolve | |
deferred.reject | |
) | |
super (resolve, reject) -> |
indent = (amount, string) -> | |
return string if !amount | |
indentation = (" " for i in [0..amount-1]).join('') | |
indentation + string.replace /\n/g, "\n" + indentation | |
nothing = "" | |
empty = (stringable) -> | |
(not stringable?) or | |
stringable.empty or |