⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
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
L1 cache reference 0.5 ns || 5.0 × 10^-10 seconds | |
Branch mispredict 5 ns || 5.0 × 10^-9 seconds | |
L2 cache reference 7 ns || 7.0 × 10^-9 seconds | |
Mutex lock/unlock 25 ns || 2.5 × 10^-8 seconds | |
Main memory reference 100 ns || 1.0 × 10^-7 seconds | |
Compress 1K bytes with Zippy 3,000 ns || 3.0 × 10^-6 seconds | |
Send 2K bytes over 1 Gbps network 20,000 ns || 2.0 × 10^-5 seconds | |
Read 1 MB sequentially from memory 250,000 ns || 0.00025 seconds | |
Round trip within same datacenter 500,000 ns || 0.00050 seconds | |
Disk seek 10,000,000 ns || 0.01 seconds |
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 'action_view' | |
module ActionView | |
module Template::Handlers | |
class NokogiriBuilder | |
class_attribute :default_format | |
self.default_format = Mime::XML | |
def call(template) | |
"xml = ::Nokogiri::XML::Builder.new { |xml|" + |
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
# Tested on DelayedJob 2.1 | |
class MyRecurringDelayedJob | |
def perform | |
# ...some slow code | |
end | |
def success(job) | |
MyRecurringDelayedJob.schedule_job(job) | |
end |
Getting zsh to work in ubuntu is weird, since sh
does not understand the source
command. So, you do this to install zsh
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh
and then you change your shell to zsh
chsh -s `which zsh`
and then restart
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 :test_log, "logs/capistrano.test.log" | |
namespace :deploy do | |
before 'deploy:update_code' do | |
puts "--> Running tests, please wait ..." | |
unless system "bundle exec rake > #{test_log} 2>&1" #' > /dev/null' | |
puts "--> Tests failed. Run `cat #{test_log}` to see what went wrong." | |
exit | |
else | |
puts "--> Tests passed" |
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
class ETLJob | |
include Sidekiq::Worker | |
sidekiq_options :queue => :ETLTasks, :backtrace => true, :retry => false | |
def perform(control_file) | |
ETL::Engine.init({:execution_dbname=>"etl_execution_prod"}) | |
ETL::Engine.process("#{Dir.pwd}/control/#{control_file}.ctl") | |
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
1,2012-01-02,New Year Day | |
2,2012-01-16,Martin Luther King Jr. Day | |
3,2012-02-20,Presidents Day (Washingtons Birthday) | |
4,2012-05-28,Memorial Day | |
5,2012-07-04,Independence Day | |
6,2012-09-03,Labor Day | |
7,2012-10-08,Columbus Day | |
8,2012-11-12,Veterans Day | |
9,2012-11-22,Thanksgiving Day | |
10,2012-12-25,Christmas Day |
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
<VirtualHost *:80> | |
ServerName diaspora.example.org | |
RedirectPermanent / https://diaspora.example.org/ | |
</VirtualHost> | |
<VirtualHost *:443> | |
ServerName diaspora.example.org | |
DocumentRoot /path/to/diaspora/public | |
RewriteEngine On |
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
# deploy.rb | |
namespace :ts_remote do | |
task :conf do | |
run <<-CMD | |
cd #{current_release} | |
&& | |
RAILS_ENV=#{rails_env} rake ts:conf | |
&& | |
rsync --progress #{current_release}/config/#{rails_env}.sphinx.conf sphinxsearch@db-server:/home/sphinxsearch/ |
OlderNewer