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
# Stash only specific files | |
# Stage the files you want to keep and run.. | |
git stash --keep-index |
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
UUID=1229D978-XXXX-XXXX-827E-0DE28E523720 none hfs rw,noauto |
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
class Event < ActiveRecord::Base | |
has_many :artists | |
end | |
class Artist < ActiveRecord::Base | |
def self.make_me_an_artist | |
create! do |artist| |
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
#!/usr/bin/env ruby | |
# Give me two arguments. | |
# 1) the path of the pwsafe xml file to import | |
# 2) the path of the csv to export | |
# format of lastpass data | |
# url,username,password,extra,name,grouping,fav | |
require 'nokogiri' |
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
source 'https://rubygems.org' | |
gem 'pg' | |
gem 'activerecord' |
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
# In rails 3 | |
Post.select(:id, :created_at).count #=> SELECT COUNT(*) FROM posts | |
# In rails 4 | |
Post.select(:id, :created_at).count #=> SELECT COUNT(id, created_at) FROM posts ... bang | |
Post.select(:id, :created_at).count(:all) #=> SELECT COUNT(*) FROM posts |
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
# A Capybara Cheatsheet |
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
# RDoc can use a custom generator but it isn't that well documentated. Here is a | |
# sample custom generator to get you going. | |
# | |
# Ruby comes with an `rdoc` executable but most of us generate our docs via Rake. To | |
# use your custom generator with Rake do something like the following in your Rakefile.. | |
# | |
# require 'rdoc/task' | |
# require 'simple_rdoc' | |
# | |
# RDoc::Task.new('simple_doc') do |i| |
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
class RecipeForm | |
ATTRIBUTES = [:name, :cooking_time_minutes] | |
attr_reader :recipe | |
attr_accessor *ATTRIBUTES | |
def initialize(recipe) | |
@recipe = recipe | |
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
<script>alert('hello');</script> |