Skip to content

Instantly share code, notes, and snippets.

@Ezku
Ezku / keybase.md
Created October 10, 2017 13:04
keybase.md

Keybase proof

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:

@Ezku
Ezku / Makefile
Created December 29, 2016 13:09
ios-sim
install:
brew install jq || brew upgrade jq
@Ezku
Ezku / keybase.md
Created February 7, 2016 20:40
Keybase proof

Keybase proof

I hereby claim:

  • I am ezku on github.
  • I am ezku (https://keybase.io/ezku) on keybase.
  • I have a public key ASDpXeidan7_uGOIRwoswhGlD0-tT8ICsyupy0sKXOYEuAo

To claim this, I am signing this object:

@Ezku
Ezku / ezku.zsh-theme
Last active August 29, 2015 14:19
standard oh-my-zsh theme with lambda as prompt
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)
@Ezku
Ezku / gist:21ae60e8aada984aea35
Created April 2, 2015 13:14
Running `source gvp` gets tedious fast, so here’s a script you can place in .zshrc
# 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")
@Ezku
Ezku / gist:57715e88e5b6059fcdbb
Last active August 29, 2015 14:13
Motivating partial application

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
@Ezku
Ezku / Thunk.coffee
Last active January 4, 2016 13:58 — forked from anonymous/Thunk.coffee
class Thunk extends Promise
evaluated: false
constructor: (resolver) ->
deferred = Promise.defer()
@eval = ->
new Promise(resolver).then(
deferred.resolve
deferred.reject
)
super (resolve, reject) ->
@Ezku
Ezku / gist:7719983
Last active December 29, 2015 19:49
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