Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
Ctrl+X | delete line |
Ctrl+↩ | insert line after |
Ctrl+⇧+↩ | insert line before |
Ctrl+⇧+↑ | move line (or selection) up |
heroku addons:add pgbackups --remote staging | |
heroku addons:add pgbackups --remote production | |
heroku pgbackups:capture --remote production | |
heroku pgbackups:restore DATABASE `heroku pgbackups:url --remote production` --remote staging |
56k: "https://123.campfirenow.com/images/56k.gif" | |
bell: ":bell:" | |
bezos: ":laughing::thought_balloon:" | |
bueller: "anyone?" | |
butts: ":open_hands: :smoking:" | |
clowntown: "https://123.campfirenow.com/images/clowntown.gif" | |
cottoneyejoe: ":notes::hear_no_evil::notes:" | |
crickets: "hears crickets chirping" | |
dadgummit: "dad gummit!! :fishing_pole_and_fish:" | |
dangerzone: "https://123.campfirenow.com/images/dangerzone.png" |
# 在本地服务器建立 rubygems.org 的镜像缓存,以提高 gem 的安装速度 | |
# 此配置设置缓存过期为1天,也就是说,新上的 gem 无法马上安装 | |
# 做这个起什么作用? | |
# rubygems 的很多资源文件是存放到 Amazon S3 上面的,由于 GFW 对某些 S3 服务器又连接重置或丢包,导致 gem 安装异常缓慢或有时候根本无法连接安装。 | |
# 而通过这种跳板的方式可以很好的解决这个问题,当然前提是 Nginx反向代理 服务器需要在国外 | |
proxy_cache_path /var/cache/rubygems levels=1:2 keys_zone=RUBYGEMS:10m | |
inactive=24h max_size=1g; | |
server { | |
listen 80; |
# Say you have two columns: start_at, end_at | |
# When start_at is defined, you want end_at's value based on the start_at | |
# Here is the solution, passing a block to get the object of the context. | |
start_at Random.new.rand(14..45).days.from_now | |
end_at { |l| l.start_at + 2.hours } | |
# Full example | |
FactoryGirl.define do | |
factory :lesson do |
.DS_Store | |
*.swp | |
*.swo | |
Gemfile.lock |
Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
Ctrl+X | delete line |
Ctrl+↩ | insert line after |
Ctrl+⇧+↩ | insert line before |
Ctrl+⇧+↑ | move line (or selection) up |
#!/usr/bin/env bash | |
set -o errtrace | |
set -o errexit | |
facter_version=$1 | |
puppet_version=$2 | |
target_volume=$3 |
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
class ActionDispatch::Routing::Mapper | |
def draw(routes_name) | |
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb"))) | |
end | |
end | |
BCX::Application.routes.draw do | |
draw :api | |
draw :account | |
draw :session |
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |