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
! = bash history | |
-2 = back two commands | |
:gs = global substitute | |
:s = single substitute first only | |
:p = preview | |
!-2:gs/orgword/newword/:p |
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
how to spit out a table's column names: | |
the following are vim commands | |
# get the table definition from the database | |
:r!echo '\d domains' | psql battery_development | |
# strip out everything besides the column name | |
:'<,'>s/^\s*\(\S\S*\)\s.*/\1/ |
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
bind -p | grep -v -e 'self.insert' -e '^#' -e 'lowercase-version' | vim - | |
This command will give you a list of bash keyboard bindings that are useful to learn. |
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
To view a list of the following shortcuts and more…for bash, run the following command: | |
bind -p | vim - # to open it in vim | |
\C = ctrl | |
\e = alt | |
pry/bash/insert-mode in vim (emacs shortcuts - which is the default keyboard mode for bash) | |
alt-b back a word | |
alt-f jump forward a word | |
alt-l lowercase word right |
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
## Required | |
# install | |
sudo gem install wirble | |
sudo gem install utility_belt | |
# settings for ~/.irbrc | |
require 'rubygems' | |
require 'utility_belt' | |
UtilityBelt::Themes.background(:dark) #optional |
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
How to make a feature with git and branches: | |
paul@dev:~/Sites/myapp(master)$ gpr #make sure your master branch is up todate with github | |
paul@dev:~/Sites/myapp(master)$ bundle #make sure all gem/plugins are installed | |
Using rake (0.8.7) | |
Using abstract (1.0.0) | |
Using activesupport (3.0.7) | |
Using builder (2.1.2) | |
Using i18n (0.5.0) | |
Using activemodel (3.0.7) |
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 'spec_helper' | |
describe FeaturePool do | |
it "creates a new instance given valid attributes" do | |
Fabricate :feature_pool | |
end | |
it "is not valid without a name" do | |
Fabricate.build(:feature_pool, :name => "").should_not be_valid | |
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
var setCryptData = function (data) { | |
window.cryptData = data.crypto_key; | |
}; | |
var submitFormWithCrypto = function (form, callback) { | |
$.getScript('/profiles/crypto_key?callback=setCryptData', function () { | |
var queryData = { | |
key_id: cryptData.id, | |
encrypted: teaEncrypt($(form).serialize(), cryptData.key) | |
}; |
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
if Rails.version.to_f >= 3.1 and Rails.application.config.assets.enabled | |
require 'capybara/util/save_and_open_page' | |
module Capybara | |
class << self | |
def save_page(html, file_name=nil) | |
rewrite_css_assets | |
save_page_html(html, file_name) | |
end | |
protected |
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
#Deploy and rollback on Heroku in staging and production | |
task :deploy_staging => ['deploy:set_staging_app', 'deploy:push', 'deploy:restart', 'deploy:tag'] | |
task :deploy_production => ['deploy:set_production_app', 'deploy:push', 'deploy:restart', 'deploy:tag'] | |
namespace :deploy do | |
PRODUCTION_APP = 'YOUR_PRODUCTION_APP_NAME_ON_HEROKU' | |
STAGING_APP = 'YOUR_STAGING_APP_NAME_ON_HEROKU' | |
task :staging_migrations => [:set_staging_app, :push, :off, :migrate, :restart, :on, :tag] | |
task :staging_rollback => [:set_staging_app, :off, :push_previous, :restart, :on] |
NewerOlder