Skip to content

Instantly share code, notes, and snippets.


Christian Trosclair xn

View GitHub Profile
View gist:875262
# Add this to more_web_steps.rb
# Selenium docs: today!
When /^I (accept|dismiss) the "([^"]*)" alert$/ do |action, text|
window = page.driver.browser.window_handle
alert = page.driver.browser.switch_to.alert
alert.text.should == text
page.driver.browser.switch_to.window window
View pathy.rb
class Hash
#this is pseudocode
def locate_and_find_all(nodes*, &block)
enum = self
while !nodes.empty?
node = nodes.pop
if enum.has_key? node
enum = enum[node]
xn /
Created Feb 21, 2012 — forked from mickm/
ruby-1.9.3-p125 cumulative performance patch.

Patched ruby 1.9.3-p125 for 30% faster rails boot

What is?

This script installs a patched version of ruby 1.9.3-p125 with patches to make ruby-debug work again (#47) and boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84).

Huge thanks to funny-falcon for the performance patches.

View helpers.rb
def render_stack(blockitem, size)
size = nil if size < 2
html = ""
link = localized.include?(blockitem) ? "" : "something"
html << "<a href=\"#{link}\" class=\"stack-link\">" # Not done, still need to change that for things
html << "<div class=\"recipe-icon\" style=\"background: url(#{url('images/wiki/#{blockitem}.png')});\" title=\"{$name}\">#{size}</div>"
html << "</a>"
xn / Findable.rb
Last active Feb 3, 2016 — forked from lypborges/Findable.rb
Create a concern to use when using uuid as default primary key
View Findable.rb
module Findable
extend ActiveSupport::Concern
# When you use uuid some methods stop to work as expected. Using this concern in your models will do the job.
# Override methods on module FinderMethods that use id as default order when no order is defined
# It's a working in progress
# referencer:
module ClassMethods