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
if (!Array.prototype.forEach) | |
{ | |
Array.prototype.forEach = function(fun /*, thisp*/) | |
{ | |
var len = this.length; | |
if (typeof fun != "function") | |
throw new TypeError(); | |
var thisp = arguments[1]; | |
for (var i = 0; i < len; 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
function bindEvent(el, eventName, eventHandler) { | |
if (el.addEventListener){ | |
el.addEventListener(eventName, eventHandler, false); | |
} else if (el.attachEvent){ | |
el.attachEvent('on'+eventName, eventHandler); | |
} | |
} |
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
# for more preferences visit this page | |
#https://getfirebug.com/wiki/index.php/Firebug_Preferences | |
require 'selenium/webdriver' | |
ORIGINAL_FIREBUG_PATH = File.expand_path(File.join(File.dirname(__FILE__),"firebug-2.0.16-fx.xpi")) | |
ORIGINAL_FIREBUG_URL = "https://getfirebug.com/releases/firebug/1.13/firebug-1.13.0a9.xpi"; |
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
ActionMailer::Base.smtp_settings = { | |
:address => "smtp.gmail.com", | |
:port => 587, | |
:domain => "gmail.com", | |
:user_name => "user_name", #Your user name | |
:password => 'pass', # Your password | |
:authentication => "plain", | |
:enable_starttls_auto => true | |
} | |
ActionMailer::Base.default_url_options[:host] = "localhost:3000" |
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
module PaginationHelper | |
class LinkRenderer < WillPaginate::ActionView::LinkRenderer | |
def link(text, target, attributes = {}) | |
attributes["data-remote"] = true if @options[:remote] | |
super | |
end | |
def pagination | |
items = @options[:page_links] ? windowed_page_numbers : [] | |
items.unshift :first_page, :previous_page |
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
params.inject({}){|memo,(k,v)| memo[k.to_s] = v.to_s; memo} |
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
def symbolize_keys(obj) | |
case obj | |
when Array | |
obj.inject([]){|res, val| | |
res << case val | |
when Hash, Array | |
symbolize_keys(val) | |
else | |
val | |
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
Capybara.register_driver :iphone do |app| | |
require 'selenium/webdriver' | |
profile = Selenium::WebDriver::Firefox::Profile.new | |
profile['general.useragent.override'] = "iPhone" | |
Capybara::Driver::Selenium.new(app, :profile => profile) | |
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
def wait_for_ajax(timeout=5, increment=0.5) #Timeout in seconds | |
# this is not exactly precise in terms of time elapsed but good enough | |
timespan = 0 | |
loop do | |
break if page.execute_script "return jQuery.active == 0" |
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
namespace :exceptions do | |
task :list => :environment do | |
exceptions = [] | |
ObjectSpace.each_object(Class) do |k| | |
exceptions << k if k.ancestors.include?(Exception) |
OlderNewer