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
=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') |
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
require 'minitest/mock' | |
require 'minitest/unit' | |
require 'date' | |
MiniTest::Unit.autorun | |
class TestMailPurge < MiniTest::Unit::TestCase | |
class MailPurge | |
def initialize(imap) | |
@imap = imap |
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
require 'fb_graph' | |
array = FbGraph::Query.new( | |
'SELECT name FROM user WHERE uid = me()' | |
).fetch(ACCESS_TOKEN) | |
p array |
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
namespace :ubuntu do | |
desc "Setup Environment" | |
task :setup_env, :roles => :app do | |
update_apt_get | |
install_dev_tools | |
install_git | |
install_subversion | |
install_sqlite3 | |
# Install and setup RVM instead of old Rails stack | |
#install_rails_stack |
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
# simple rake task to output a changelog between two commits, tags ... | |
# output is formatted simply, commits are grouped under each author name | |
# | |
desc "generate changelog with nice clean output" | |
task :changelog, :since_c, :until_c do |t,args| | |
since_c = args[:since_c] || `git tag | head -1`.chomp | |
until_c = args[:until_c] | |
cmd=`git log --pretty='format:%ci::%an <%ae>::%s::%H' #{since_c}..#{until_c}` | |
entries = Hash.new |
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
$ node yui.js | |
info: (yui): Modules missing: io, 1 | |
info: (yui): Fetching loader: /usr/local/lib/node/.npm/yui3-core/3.3.0/package/build/loader/loader-debug.js | |
info: (get): URL: /usr/local/lib/node/.npm/yui3-core/3.3.0/package/build/loader/loader-debug.js | |
info: (get): Loaded: /usr/local/lib/node/.npm/yui3-core/3.3.0/package/build/loader/loader-debug.js | |
info: (yui): Modules missing: oop,parallel,event-custom-base,nodejs-dom,event-base,dom,node-base,dom-style-ie,node-style,queue-promote,datatype-xml,io,io-nodejs, 13 | |
info: (yui): Using Loader | |
info: (loader): attempting to load oop, /usr/local/lib/node/.npm/yui3-core/3.3.0/package/build/ | |
info: (get): URL: /usr/local/lib/node/.npm/yui3-core/3.3.0/package/build/oop/oop-min.js | |
info: (get): Loaded: /usr/local/lib/node/.npm/yui3-core/3.3.0/package/build/oop/oop-min.js |
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
------------ From Rake Task | |
namespace :app do | |
# Checks and ensures task is not run in production. | |
task :ensure_development_environment => :environment do | |
if Rails.env.production? | |
raise "\nI'm sorry, I can't do that.\n(You're asking me to drop your production database.)" | |
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
# autoload concerns | |
module YourApp | |
class Application < Rails::Application | |
config.autoload_paths += %W( | |
#{config.root}/app/controllers/concerns | |
#{config.root}/app/models/concerns | |
) | |
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
# Give it two procs to compare | |
def bm(o, n); reload!; puts "Running 10 times"; Benchmark.bmbm(10) { |x| x.report('Old Query:') { @olr = o.call }; x.report('New Query:') { @nr = n.call } }; reload!; puts 'Old Result:' ; table(@olr); puts 'New Result'; table(@nr); 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
backend default { | |
.host = "127.0.0.1"; | |
.port = "3000"; | |
} | |
acl admin { | |
"127.0.0.1"; | |
} | |
sub vcl_recv { |
OlderNewer