Skip to content

Instantly share code, notes, and snippets.

@mycargus
mycargus / start_rails_server.txt
Created May 27, 2015 02:55
Start a rails server in Cloud9. Execute in Cloud9 terminal. From https://docs.c9.io/v1.0/docs/running-a-rails-app
rails s -b $IP -p $PORT
config.after :all do
ActiveRecord::Base.subclasses.each(&:delete_all)
end

Tabs and Windows

Function Shortcut
Previous Tab + Left Arrow
Next Tab + Right Arrow
Go to Tab + Number
Go to Window + Option + Number
Go to Split Pane by Direction + Option + Arrow
Go to Split Pane by Order of Use + ] , + [
@mycargus
mycargus / .vimrc
Created July 6, 2015 21:30
My custom vim
syntax enable
set tabstop=2
set softtabstop=2
set expandtab
set number
set showcmd
set cursorline
set wildmenu
set lazyredraw
set showmatch
@mycargus
mycargus / create_new_specs_branch.sh
Last active August 29, 2015 14:25
I got tired of repeating myself and forgetting commands when creating a new branch for automating specs.
#!/bin/bash
# Add me to your .bashrc file (except for the shebang at the top of this file)
# Usage: `create_new_specs_branch <name_of_new_branch>`
# Example: `create_new_specs_branch quiz_spec`
create_new_specs_branch() {
cd ~/code/canvas-lms-local # <--- change this path according to your setup
printf "\nI moved you into $(pwd). You're welcome.\n"
undefined method `workflow_state' for nil:NilClass
/var/web/canvas/releases/2015-07-16_174812_26b4ef4a508d509b/app/controllers/quizzes/quiz_submissions_api_controller.rb:176:in `index'
/var/web/canvas/releases/2015-07-16_174812_26b4ef4a508d509b/vendor/cache/rails-b344986bc3d9/actionpack/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/var/web/canvas/releases/2015-07-16_174812_26b4ef4a508d509b/vendor/cache/rails-b344986bc3d9/actionpack/lib/abstract_controller/base.rb:167:in `process_action'
/var/web/canvas/releases/2015-07-16_174812_26b4ef4a508d509b/vendor/cache/rails-b344986bc3d9/actionpack/lib/action_controller/metal/rendering.rb:10:in `process_action'
/var/web/canvas/releases/2015-07-16_174812_26b4ef4a508d509b/vendor/cache/rails-b344986bc3d9/actionpack/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
/var/web/canvas/releases/2015-07-16_174812_26b4ef4a508d509b/vendor/cache/rails-b344986bc3d9/activesupport/lib/active_support/callbacks.rb:735:in `block (2 l
y - stash this hunk
n - do not stash this hunk
q - quit; do not stash this hunk or any of the remaining ones
a - stash this hunk and all later hunks in the file
d - do not stash this hunk or any of the later hunks in the file
g - select a hunk to go to
/ - search for a hunk matching the given regex
j - leave this hunk undecided, see next undecided hunk
J - leave this hunk undecided, see next hunk
k - leave this hunk undecided, see previous undecided hunk
@mycargus
mycargus / capybara cheat sheet
Last active September 16, 2015 20:28 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=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')
@mycargus
mycargus / gist:536f4e46db39c563eb42
Created September 24, 2015 20:08 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

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
describe FunctionalInterface do
before :all do
@implementations =
ObjectSpace.each_object(Class)
.select { |klass| klass < FunctionalInterface }
end
it "should enforce that the interface is implemented" do
@implementations.each do |klass|
entity = klass.new