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
git bisect start HEAD HEAD~20 && git bisect run rspec ./spec/YOUR_TEST_FILE.rb:LINE_NUMBER ; git bisect reset |
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
find $(manpath | tr ':' '\n') -iname '*.1' | xargs cat | (LC_CTYPE=C tr -C '[:alnum:]-_' '\n') | egrep '^--[\-_[:alnum:]]+$' | sort | uniq -c | sort -n |
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 'active_support' | |
class MyLogger < ActiveSupport::BufferedLogger | |
SEVERITY_NAME = %w( DEBUG INFO WARN ERROR FATAL UNKNOWN ) | |
def custom_line(severity, message) | |
# Customized Log Format! | |
message = [Time.now.strftime("%Y-%m-%d %H:%M:%S"), ENV['BL_JOB_ID']||$$, SEVERITY_NAME[severity], message].join("\t") | |
end | |
def add(severity, message = nil, progname = nil, &block) |
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
sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql-5.1.38-osx10.5-x86_64/bin/mysql_config |
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 'net/http' | |
require 'uri' | |
require 'json' | |
# sudo gem install json | |
# Usage example: | |
# putio = Putio.new("YOUR_API_KEY","YOUR_API_SECRET") | |
# puts JSON.parse(putio.user.friends.get) | |
# puts JSON.parse(putio.search :query => "massive attack" |
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
var input = document.getElementById('myfileinput'); | |
var files = input.files; | |
var file = files[i]; | |
var xhr = new XMLHttpRequest(); | |
xhr.open('post', '/path/to/destination', true); | |
xhr.onreadystatechange = function() { | |
if (this.readyState != 4) { return; } | |
// request finished - handle response | |
}; |
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
;; first, remove all the crap that looks different from emacs 20.7.1 | |
; luddite mode | |
(cond ((> emacs-major-version 20) | |
(tool-bar-mode -1) ; introduced in emacs 21 | |
(menu-bar-mode -1) | |
(scroll-bar-mode -1) | |
(menu-bar-showhide-fringe-menu-customize-disable) | |
(blink-cursor-mode -1) | |
(windmove-default-keybindings 'meta))) |
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
es_alias = ENV.fetch('ALIAS') | |
hosts = ENV.fetch('HOSTS') | |
old_index = ENV.fetch('OLD_INDEX') | |
old_type = ENV.fetch('OLD_TYPE') | |
new_index = ENV.fetch('NEW_INDEX') | |
new_type = ENV.fetch('NEW_TYPE') | |
size = ENV.fetch('SCAN_SIZE', 100) | |
client = Elasticsearch::Client.new(hosts: hosts) | |
unless client.indices.exists(index: new_index) |
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
module Marshal | |
class << self | |
@@prok = Proc.new { |o| o.is_a?(String) ? Iconv.iconv("UTF-8//IGNORE", "UTF-8", o.force_encoding("UTF-8").encode("UTF-8")).first : o } | |
alias old_load load | |
def load(source) | |
old_load source, @@prok | |
end | |
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
describe "routes to the articles controller" do | |
extend RouteSpecHelpers | |
scope_options controller: 'articles', blog: 'my_blog' | |
get '/blogs/my_blog/articles/new' => { action: 'new' } | |
post '/blogs/my_blog/articles' => { action: 'create' } | |
get '/blogs/my_blog/articles/1' => {action: 'show', id: '1' } | |
OlderNewer