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
# Example of how you can to use Capybara with plain Rails' integration tests and FactoryGirl (or plain MyModel.create…) | |
require 'test_helper' | |
require 'capybara' | |
require 'capybara/dsl' | |
require 'database_cleaner' | |
Capybara.app = Pardy::Application | |
Capybara.default_driver = :rack_test | |
DatabaseCleaner.strategy = :truncation |
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
module OmniAuth | |
module Strategies | |
# tell OmniAuth to load our strategy | |
autoload :Pixelation, 'lib/pixelation_authorization' | |
end | |
end | |
Rails.application.config.middleware.use OmniAuth::Builder do | |
provider :twitter, "app_name", "secret" | |
provider :facebook, "app_name", "secret", :scope => '' |
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
.DS_Store | |
*.log | |
Gemfile.lock |
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
class Article | |
attr_reader :filename | |
def initialize(filename) | |
@filename = filename | |
end | |
def <=> other | |
self.filename <=> other.filename | |
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
require 'mysql2' | |
client = Mysql::Client.new(:host => "localhost", :username => "root") | |
# Fetch running threads | |
processes = client.query("SHOW FULL PROCESSLIST") | |
processes.each do |process| | |
# Kill thread |
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
<ul class="social-links"> | |
<li class="facebook"><%= link_to "Like us on Facebook", facebook_path %></li> | |
<li class="twitter"><%= link_to "Follow us on Twitter", twitter_path %></li> | |
</ul> |
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
/*! | |
* jQuery TextChange Plugin | |
* http://www.zurb.com/playground/jquery-text-change-custom-event | |
* | |
* Copyright 2010, ZURB | |
* Released under the MIT License | |
*/ | |
(function ($) { | |
$.event.special.textchange = { |
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
class ActionDispatch::Routing::Mapper | |
def draw(routes_name) | |
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb"))) | |
end | |
end | |
BCX::Application.routes.draw do | |
draw :api | |
draw :account | |
draw :session |
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
Animals.each do |letter, results| | |
10.times do | |
doc = Nokogiri::HTML(open("http://www.ocar.org/page.php?tut=realtor-affiliate-search-results&tid=802&pid=8&first_or_last_name=#{letter}&city=&office=&btc=&op=find_a_realtor&ftut=find-a-realtor&start=#{results_per_page}")) | |
realtors = {} | |
('a'..'z').each do |n| | |
realtors[n] = Realtor.create | |
end | |
doc.css('div.search_results_item').each do |number| | |
phone_number = /\(\d{3}\)\s\d{3}-\d{4}/.match("#{number.content}") | |
('a'..'z').each do |n| |
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' | |
feature "Editing tickets" do | |
let!(:project) { Factory(:project) } | |
let!(:ticket) { Factory(:ticket, :project => project) } | |
before do | |
visit '/' | |
click_link project.name | |
click_link ticket.title |
OlderNewer