View vim_cheatsheet
1 2 3 4 5 6 7 8 9 10
VIM Cheatsheet
 
Text Entry
 
a Append text following current cursor position
A Append text to the end of current line
i Insert text before the current cursor position
I Insert text at the beginning of the cursor line
o Open up a new line following the current line and add text there
O Open up a new line in front of the current line and add text there
View gist:4f966606e1977133b026
1 2 3 4 5 6 7 8 9 10
" Leader
let mapleader = " "
 
set t_Co=256
set backspace=2 "
let &colorcolumn="80"
set nocompatible " Use Vim settings, rather then Vi settings
set nobackup
set nowritebackup
set noswapfile " http://robots.thoughtbot.com/post/18739402579/global-gitignore#comment-458413287
View capybara cheat sheet
1 2 3 4 5 6 7 8 9 10
=Navigating=
visit('/projects')
visit(post_comments_path(post))
 
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
View gist:9742583
1 2 3 4 5 6 7 8 9 10
CarrierWave.configure do |config|
config.fog_credentials = {
:provider => 'AWS', # required
:aws_access_key_id => 'xxx', # required
:aws_secret_access_key => 'yyy', # required
:region => 'eu-west-1', # optional, defaults to 'us-east-1'
:host => 's3.example.com', # optional, defaults to nil
:endpoint => 'https://s3.example.com:8080' # optional, defaults to nil
}
config.fog_directory = 'name_of_directory' # required
View legacy_swithcing.rb
1 2 3 4 5 6 7 8 9
# put all new_layout views in the following new folder: app/views_new_layout
## Do NOT put the views in app/views
# you need a migration in Users called new_layout:boolean this does not need a default value
## The below code will assume the new layout for all users, unless they explicitly say no.
### for example, if you want to put an ajax box at the top of the new page that says
#### "This is our new layout. Switch back to old one? If they click the link, then it sets the boolean to false.
##### You can also have them switch back and forth easily. If they make no preference (thus the boolean is nil,) then new layout is used.
# You can reverse this logic very easily if you want to default to the old layout.
 
View gist:6791483
1 2 3 4 5 6 7 8 9 10
$ pg_resetxlog /usr/local/var/postgres
pg_resetxlog: lock file "/usr/local/var/postgres/postmaster.pid" exists
Is a server running? If not, delete the lock file and try again.
$ rm /usr/local/var/postgres/postmaster.pid
$ pg_resetxlog /usr/local/var/postgres
The database server was not shut down cleanly.
Resetting the transaction log might cause data to be lost.
If you want to proceed anyway, use -f to force reset.
$ pg_resetxlog -f /usr/local/var/postgres
Transaction log reset
View gist:6390687
1 2 3 4 5 6 7 8 9 10
{
"color_scheme": "Packages/User/Monokai Soda.tmTheme",
"draw_white_space": "selection",
"font_face": "Source Code Pro",
"font_size": 14.0,
"rulers":
[
80
],
"tab_size": 2,
View gist:5877161

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
View examples.rb
1 2 3 4 5 6 7 8 9 10
class SomeClass
SOME_CONSTANT = 'upper case name'
def initialize(attributes)
@some_attribute = attributes[:some_attribute]
@another_attribute = attributes[:another_attribute]
@user_factory = attributes[:user_factory]
end
def method_with_arguments(argument_one, argument_two)
Something went wrong with that request. Please try again.