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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
defmodule Repo.Migrations.CreateCards do | |
use Ecto.Migration | |
def up do | |
"CREATE TABLE IF NOT EXISTS cards ( | |
id SERIAL PRIMARY KEY, | |
name VARCHAR (255) UNIQUE NOT NULL, | |
class VARCHAR (255) NOT NULL, | |
stars INTEGER NOT NULL, | |
cost INTEGER NOT NULL, |
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
#!/usr/bin/ruby | |
# Add all gems installed in the system to the $LOAD_PATH so they can be used in Rails console with Bundler | |
if defined?(::Bundler) | |
current_ruby_version = `rbenv version`.split(" ").first | |
gem_paths = Dir.glob("#{ENV["HOME"]}/.rbenv/versions/#{current_ruby_version}/lib/ruby/gems/**/gems/*/lib") | |
gem_paths.each do |path| | |
$LOAD_PATH << path | |
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
In your .irbrc file put: | |
load File.dirname(__FILE__) + '/.railsrc' if ($0 == 'irb' && ENV['RAILS_ENV']) || ($0 == 'script/rails' && Rails.env) | |
This is the .railsrc file | |
#!/usr/bin/ruby | |
begin | |
require 'hirb' # sudo gem install cldwalker-hirb --source http://gems.github.com | |
Hirb.enable | |
rescue LoadError |
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
" Line number stuff | |
set rnu | |
au InsertEnter * :set nu | |
au InsertLeave * :set rnu | |
au FocusLost * :set nu | |
au FocusGained * :set rnu |
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
List Backups | |
heroku pgbackups --app {PRODUCTION_APP_NAME} | |
Get URL for a backup | |
heroku pgbackups:url {ID} --app {PRODUCTION_APP_NAME} | |
Restore to test | |
heroku pgbackups:restore DATABASE {BIG_LONG_URL} --app {TEST_APP_NAME} |
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
curl -X POST http://127.0.0.1:5984/geopoll/_bulk_docs -data-binary @seeds.json -H "Content-Type:application/json" -v |
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
# in application_helper.rb | |
def comment(&block) | |
#SWALLOW THE BLOCK | |
end | |
# in code | |
<% comment do %> | |
stuff to comment out here | |
<% end %> |