Skip to content

Instantly share code, notes, and snippets.

@emorikawa
emorikawa / gist:a091dfded1643ef86299
Created Jul 30, 2014
Convert RSpec `should` syntax to newer `expect` syntax
View gist:a091dfded1643ef86299
command! ShouldToExpect %s/\(^\s\+\)\(.\+\)\.should \(.\+\)/\1expect(\2).to \3/
@emorikawa
emorikawa / gist:9275c0de23176ae5031a
Last active Aug 29, 2015
Advanced Coffeescript Mixins
View gist:9275c0de23176ae5031a
window.include = (obj) ->
console.log @
@::[key] = value for key, value of obj; @
Module = {}
Module.Foo = (_super) ->
overwriteMethod: -> "Foo"
extendMethod: -> "Foo"
fooMethod: -> @
boundFooMethod: => @
@emorikawa
emorikawa / pinterest_followers.js
Created Jun 17, 2014
Pinterest Followers Sorted by Followers
View pinterest_followers.js
// 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)
View keybase.md

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 / gist:9816947
Created Mar 27, 2014
Proximate Lines of Code
View gist:9816947
❮~/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
@emorikawa
emorikawa / lambda-calculus.coffee
Created Feb 21, 2014
Lambda Calculus in Coffeescript
View lambda-calculus.coffee
# 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
You can’t perform that action at this time.