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
# sudo gem install bson | |
# sudo gem install bson_ext | |
# sudo gem install yajl-ruby | |
# sudo gem install json | |
# sudo gem install msgpack | |
require 'rubygems' | |
require 'benchmark' | |
require 'yaml' | |
require 'bson' |
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 'spec_helper' | |
describe Users::OauthCallbacksController, "handle facebook authentication callback" do | |
describe "#annonymous user" do | |
context "when facebook email doesn't exist in the system" do | |
before(:each) do | |
stub_env_for_omniauth | |
get :facebook |
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
brew install https://raw.github.com/cobrateam/formulae/master/swig.rb |
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
def self.pretty_hash(hash) | |
results = [] | |
hash.keys.each do |key| | |
results << key | |
if hash[key].respond_to?(:keys) | |
results << pretty_hash(hash[key]).split("\n").map do | line | | |
" -- " + line | |
end | |
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
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
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
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc | |
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/ | |
// author: Pawel Kozlowski | |
var myApp = angular.module('myApp', []); | |
//service style, probably the simplest one | |
myApp.service('helloWorldFromService', function() { | |
this.sayHello = function() { | |
return "Hello, World!" |
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_form_for @product do |f| %> | |
<%= f.simple_fields_for :attributes do |d| %> | |
<% f.object.attributes.try(:each) do |key, value| %> | |
<%= d.input key, :input_html => {:value => value } %> | |
<% end %> | |
<% 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
#!/usr/bin/env ruby | |
# A quick script to download all your files from CloudApp. | |
# To run this just run the script passing your e-mail & password | |
# to the script, for example: | |
# | |
# gem install cloudapp_api | |
# ruby cloudapp-export.rb [email protected] mypassword | |
# |
OlderNewer