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 ActionController::TestCase < ActiveSupport::TestCase | |
module Behavior | |
def process_with_default_params(action, parameters = nil, session = nil, flash = nil, http_method = 'GET') | |
default_params = {:locale => :en} | |
parameters ||= {} | |
parameters.reverse_merge! default_params | |
process_without_default_params(action, parameters, session, flash, http_method) | |
end | |
alias_method_chain :process, :default_params | |
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
(function($){ | |
$.delayedChangeDelay = 1000; | |
$.checkUpdateTime = 500; | |
// Special event definition. | |
$.event.special.delayedChange = { | |
setup: function( params ) { | |
// Add data and handlers to other events |
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
ko.bindingHandlers.instedd_init = | |
init: (element, valueAccessor, allBindingsAccessor, viewModel) -> | |
$.instedd.init_components($(element)) |
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
if $('#my_div_in_complex_page').length > 0 | |
class Foo | |
... |
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 'yaml' | |
require 'csv' | |
FILE = 'sample.vrb' | |
class Recording < Struct.new(:step_id, :step_name, :message, :duration) | |
def self.from_step(step, message='message') | |
self.new(step['id'], step['name'], message, (step[message]['duration'] rescue nil)) | |
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
# Based on version by https://github.com/mgbaron/activerecord_vertica_adapter2/blob/master/lib/active_record/connection_adapters/vertica_adapter.rb | |
# Place this file in lib/extras/active_record/connection_adapters/vertica_adapter.rb and require it when needed | |
# You may use a different connection by specifying `establish_connection Rails.configuration.database_configuration["census"]` | |
require 'active_record/connection_adapters/abstract_adapter' | |
require 'arel/visitors/bind_visitor' | |
module ActiveRecord | |
class Base | |
# Establishes a connection to the database that's used by all Active Record objects |
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 Array | |
def first_with_block(&block) | |
block_given? ? find(&block) : first_without_block | |
end | |
alias_method_chain :first, :block | |
end | |
# 1.9.3p0 :009 > [1,2,3,4,5].first{|x| x > 2} | |
# => 3 | |
# 1.9.3p0 :010 > [1,2,3,4,5].first |
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
import re | |
import fileinput | |
import os | |
from glob import glob | |
ICML_DIR = "icml" | |
OUT_DIR = "output" | |
# Get icml files in memory |
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
# Load DSL and Setup Up Stages | |
require 'capistrano/setup' | |
# Includes default deployment tasks | |
require 'capistrano/deploy' | |
# Loads custom tasks from `lib/capistrano/tasks' if you have any defined. | |
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r } | |
namespace :deploy do |
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
# Go to Verboice main folder | |
cd verboice | |
# Open console | |
bundle exec rails c production | |
# Retrieve the first user | |
u = User.first | |
# This line should print the user's email, check that it is the one you expect |