This file contains 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 'cgi' | |
def to_query(param, namespace = nil) | |
case param | |
when Hash | |
param.collect do |key, value| | |
unless (value.is_a?(Hash) || value.is_a?(Array)) && value.empty? | |
to_query(value, namespace ? "#{namespace}[#{key}]" : key) | |
end | |
end.compact.sort! * '&' |
This file contains 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
set runtimepath^=~/.vim/bundle/ctrlp.vim | |
execute pathogen#infect() | |
syntax on | |
filetype plugin indent on | |
set number | |
colorscheme torte | |
set tabstop=2 | |
set shiftwidth=2 | |
set expandtab |
This file contains 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
%s/^\( *\)\([a-z_]\+\):/\1"\2" =>/ |
This file contains 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
(function(global){ | |
var FPSLogger = (function(){ | |
var count = 0; | |
var time; | |
var fps = 0; | |
function start(){ | |
time = Date.now(); | |
count = 0; | |
} |
This file contains 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
Raven.config('http://ac7d77fa84aa407a96ae325c4d0b90fe@sentry.example.com:9000/2', {}).install(); | |
window.onerror = function (errorMsg, file, lineNumber, colNumber, error) { | |
console.log('onerror', error); | |
var id = Math.floor(Math.random() * 1000) | |
var email = ""; | |
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; | |
for( var i=0; i < 5; i++ ) | |
email += possible.charAt(Math.floor(Math.random() * possible.length)); |
This file contains 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
(function(global){ | |
var _isSupported = window.history && window.history.pushState && window.history.replaceState && | |
!navigator.userAgent.match(/((iPod|iPhone|iPad).+\bOS\s+[1-4]|WebApps\/.+CFNetwork)/); | |
function Pjaxer(){ | |
var _callbacks = {}; | |
var _caches = {}; | |
var _target; | |
initialize.apply(this, arguments); |
This file contains 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
function fibonacci(index){ | |
if(index == 0){ | |
return 0; | |
}else if(index == 1){ | |
return 1; | |
} | |
var a = 0, b = 1, value = 0; | |
for(var i = 1; i < index; i++){ | |
value = a + b; | |
a = b; |
This file contains 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
#!/usr/bin/ruby | |
require 'RMagick' | |
require 'json' | |
include Magick | |
dir_name = ARGV[0] | |
css_dir = ARGV[1] || 'css/' | |
img_dir = ARGV[2] || 'img/' | |
dir_name += '/' unless dir_name =~ /\/$/ |
This file contains 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
#!/usr/bin/ruby | |
dir_name = ARGV[0] | |
dir_name += '/' unless dir_name =~ /\/$/ | |
Dir.open(dir_name).each do |f| | |
p dir_name + f | |
end |
This file contains 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 'webrick' | |
srv = WEBrick::HTTPServer.new({ | |
:DocumentRoot => '/', | |
:BinAddress => 'localhost', | |
:Port => 8888 | |
}) | |
srv.mount('/', WEBrick::HTTPServlet::FileHandler, Dir.pwd, {:FancyIndexing => true}) |