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
defaults write com.apple.Dock autohide-delay -float 0 && killall Dock |
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
1xx Informational | |
100 Continue :continue | |
101 Switching Protocols :switching_protocols | |
102 Processing :processing | |
2xx Success | |
200 OK :ok | |
201 Created :created | |
202 Accepted :accepted | |
203 Non-Authoritative Information :non_authoritative_information |
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
{ | |
"auto_complete": false, | |
"auto_match_enabled": false, | |
"bold_folder_labels": true, | |
"color_scheme": "Packages/Color Scheme - Default/Twilight.tmTheme", | |
"drag_text": false, | |
"draw_white_space": "selection", | |
"fold_buttons": false, | |
"font_face": "M+ 1M thin", | |
"font_size": 16.0, |
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
JSON.pretty_generate(JSON.parse(obj.to_json)) |
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
#188s | |
(0..10000).each do | |
document1.sub_documents << document2 | |
end | |
#119s | |
(0..10000).each do | |
document1.push(:sub_document_ids, document2._id) | |
end |
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 FooSerializer < ActiveModel::Serializer | |
attributes :_id, :name | |
def attributes | |
h = super | |
h.select! { |x| options[:only].include? x } if options[:only] | |
h | |
end | |
end |
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
# return only HTTP status code | |
curl -sL -w "%{http_code}\\n" "http://news.ycombinator.com/" -o /dev/null | |
# return only HTTP status code and 302 URL | |
curl -sL -w "%{http_code} %{url_effective}\\n" "http://news.ycombinator.com/" -o /dev/null | |
# header only | |
curl -I news.ycombinator.com | |
# basic auth |
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 'net/smtp' | |
message = <<MESSAGE_END | |
From: Sender <name@sender_domain.com> | |
To: Receiver <name@receiver_domain.com> | |
Subject: SMTP e-mail test | |
This is a test e-mail message. | |
MESSAGE_END |
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
cd ~/Library/Application Support/Sublime Text 2/Packages | |
mv ./User/ ./User_old/ | |
ln -s ~/Dropbox/Sublime/Packages/User ./User | |
# Edit this in Package/Color Scheme - Default/Twilight | |
# <key>lineHighlight</key> | |
# <string>#302030</string> |
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
exc = assert_raises Mongoid::Errors::Validations do | |
subject.do_something | |
end | |
assert exc.message.include?("something failed") |