This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" .vimrc | |
" How to pwn javascript's syntax without anyone ever knowing: | |
" substitutes `function` with `->` on file load, and reverses it on write. | |
autocmd BufRead,BufWritePost *.js silent %s/function/->/ | |
autocmd BufWritePre *.js silent %s/->/function/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -3,7 +3,14 @@ module ActiveSupport | |
inflect.plural(/$/, 's') | |
inflect.plural(/s$/i, 's') | |
inflect.plural(/(ax|test)is$/i, '\1es') | |
- inflect.plural(/(octop|vir)us$/i, '\1i') | |
+ | |
+ # Note that 'octopuses' is equally correct | |
+ inflect.plural(/(octop)us$/i, '\1i') | |
+ | |
+ # The correct plural of 'virus' is actually 'viruses', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sys = require('sys'); | |
process.delay = function (fun) { | |
return setTimeout(fun, 0); | |
}; | |
var func = function () { | |
var promise = new process.Promise(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Router = { | |
context: { | |
from: function(arg) { | |
return { | |
to: function(arg) { return arg; } | |
} | |
} | |
}, | |
map: function(block) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'action_view' | |
require 'active_support' | |
class MenuItem | |
include ActionView::Helpers::TagHelper, | |
ActionView::Helpers::UrlHelper | |
attr_accessor :children, :link | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Object | |
def expect m | |
(class << self; self; end).class_eval do | |
define_method("#{m}_") do | |
$expected = true | |
send("__#{m}__") | |
end | |
alias :"__#{m}__" :"#{m}" | |
alias :"#{m}" :"#{m}_" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Project Euler in Haskell -- | |
-- by cloudhead -- | |
-- "there's some real nasty code in here" | |
import Char | |
-- Some useful functions | |
-- | |
prime :: Integer -> Bool |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CLEAR=$'\e[00m' | |
BLACK=$'\e[0;30m' | |
RED=$'\e[0;31m' | |
GREEN=$'\e[0;32m' | |
YELLOW=$'\e[0;33m' | |
BLUE=$'\e[0;34m' | |
PURPLE=$'\e[0;35m' | |
CYAN=$'\e[0;36m' | |
WHITE=$'\e[0;37m' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'irb/completion' | |
require 'irb/ext/save-history' | |
require 'open-uri' | |
require 'json' | |
require 'cgi' | |
ANSI_YELLOW = "\033[1;33m" | |
ANSI_PURPLE = "\033[0;35m" | |
ANSI_LPURPLE = "\033[1;35m" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
doubleMe x = x + x | |
doubleUs x y = doubleMe x + doubleMe y | |
doubleSmallNumber x = if x < 100 | |
then x * 2 | |
else x | |
eoeo xs = [if mod x 2 == 0 then 'e' else 'o' | x <- xs] | |
length'' xs = sum [1 | _ <- xs] | |
combo xs ys = [x ++ " " ++ y | x <- xs, y <- ys] | |
nestedEven xxs = [[ x | x <- xs, even x] | xs <- xxs] |