Skip to content

Instantly share code, notes, and snippets.

@emorikawa
emorikawa / lambda-calculus.coffee
Created February 21, 2014 17:36
Lambda Calculus in Coffeescript
# Combinators
I = (x) -> x
# Church Numerals
int = (n) -> n((x) -> ++x)(0) # Converts Chruch Numeral to literal integer
$0 = ZERO = (f) -> (x) -> x
$1 = ONE = (f) -> (x) -> f x
$2 = TWO = (f) -> (x) -> f f x
$3 = THREE = (f) -> (x) -> f f f x
$4 = FOUR = (f) -> (x) -> f f f f x
@emorikawa
emorikawa / gist:9816947
Created March 27, 2014 19:59
Proximate Lines of Code
❮~/Code❯ cloc Proximate (~/Code 15:58:49 ☉ 4.5°C )
695 text files.
692 unique files.
7584 files ignored.
http://cloc.sourceforge.net v 1.60 T=5.34 s (97.6 files/s, 24777.2 lines/s)
--------------------------------------------------------------------------------
Language files blank comment code
--------------------------------------------------------------------------------
Javascript 47 7064 5372 52039

Keybase proof

I hereby claim:

  • I am emorikawa on github.
  • I am e0m (https://keybase.io/e0m) on keybase.
  • I have a public key whose fingerprint is BEA0 3598 8AC7 8273 94BE 567A 3660 9A94 21CC B5B8

To claim this, I am signing this object:

@emorikawa
emorikawa / pinterest_followers.js
Created June 17, 2014 04:55
Pinterest Followers Sorted by Followers
// For http://www.pinterest.com/USERNAME/following/
// I want to find who the big-names are on Pinterest. They currently don't provide a good way to do that.
fcount = function(el){return parseInt(el.innerHTML.replace(/,/g,"").match(/(\d+) Followers/)[1])}
sorted = $("p.userStats").sort(function(a,b){return fcount(b) - fcount(a)})
i = 1; console.log(fcount(sorted[i])); sorted[i].scrollIntoView(true)
@emorikawa
emorikawa / gist:9275c0de23176ae5031a
Last active August 29, 2015 14:03
Advanced Coffeescript Mixins
window.include = (obj) ->
console.log @
@::[key] = value for key, value of obj; @
Module = {}
Module.Foo = (_super) ->
overwriteMethod: -> "Foo"
extendMethod: -> "Foo"
fooMethod: -> @
boundFooMethod: => @
@emorikawa
emorikawa / test.txt
Created October 26, 2015 23:01
API test
Hello World
@emorikawa
emorikawa / gist:a091dfded1643ef86299
Created July 30, 2014 18:37
Convert RSpec `should` syntax to newer `expect` syntax
command! ShouldToExpect %s/\(^\s\+\)\(.\+\)\.should \(.\+\)/\1expect(\2).to \3/