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
# thanks ROR! | |
def distance_of_time_in_words(from_time, to_time = 0, include_seconds = false) | |
from_time = from_time.to_time if from_time.respond_to?(:to_time) | |
to_time = to_time.to_time if to_time.respond_to?(:to_time) | |
distance_in_minutes = (((to_time - from_time).abs)/60).round | |
distance_in_seconds = ((to_time - from_time).abs).round | |
case distance_in_minutes | |
when 0..1 | |
return (distance_in_minutes == 0) ? 'less than a minute' : '1 minute' unless include_seconds |
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
// cucumber-json | |
{ | |
"features": | |
[ | |
" Scenario: Delayed announcements feature\n When I run cucumber --format pretty features/f.feature\n Then STDERR should be empty\n And the output should contain\n \"\"\"\n Feature: F\n\n Scenario: S # features/f.feature:3\n Given I use announce with text \"Ann\" # features/step_definitions/steps.rb:1\n Ann\n And this step works # features/step_definitions/steps.rb:21\n\n Scenario: S2 # features/f.feature:7\n Given I use multiple announces # features/step_definitions/steps.rb:5\n Multiple\n Announce\n Me\n And this step works # features/step_definitions/steps.rb:21\n\n Scenario Outline: S3 # features/f.feature:11\n Given I use announcement <ann> in line <line> # features/f.feature:12\n\n Examples: \n | line | ann |
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 solve(input, name_index, left_index, right_index) | |
min, result = 100, nil | |
input.each_line do |line| | |
next unless line =~ /^\s*\d/ | |
row = line.strip.split(/\s+/).map { |e| (digits = e[/\d+/]) ? digits.to_i : e } | |
name = row[name_index] | |
left = row[left_index] | |
right = row[right_index] |
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 Command | |
def self.before_main(*syms) | |
return @before_main_methods if syms.empty? | |
@before_main_methods = syms | |
end | |
def before_main | |
meths = self.class.before_main | |
meths.each { |m| send(m) } if meths | |
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 "rubygems" | |
require "curb" | |
require "sinatra/base" | |
class App < Sinatra::Base | |
get "/" do | |
"get" | |
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
# workaround for bug in cucumber 0.8.1 | |
module Cucumber | |
module Ast | |
module FeatureElement | |
def source_tag_names | |
(@tags.tag_names + (@feature ? @feature.source_tag_names : [])).to_a.uniq | |
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
Index: common/src/rb/lib/selenium/webdriver/child_process.rb | |
=================================================================== | |
--- common/src/rb/lib/selenium/webdriver/child_process.rb (revision 9164) | |
+++ common/src/rb/lib/selenium/webdriver/child_process.rb (working copy) | |
@@ -125,9 +125,14 @@ | |
self | |
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
From 9d6f71177bedad4e9891c7e57015e83ca8def8c5 Mon Sep 17 00:00:00 2001 | |
From: Jari Bakken <[email protected]> | |
Date: Sat, 19 Jun 2010 11:54:52 +0200 | |
Subject: [PATCH] Fix ./configure on Linux + 1.9 where lsb_release is missing. | |
On 1.9, Kernel#` will raise Errno::ENOENT if the command is not found. | |
--- | |
configure | 2 +- | |
1 files changed, 1 insertions(+), 1 deletions(-) |
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
Building Melbourne for MRI | |
CXX bstrlib.c | |
CXX var_table.cpp | |
CXX grammar.cpp | |
grammar.y: In function ‘int melbourne::here_document(melbourne::NODE*, melbourne::rb_parse_state*)’: | |
grammar.y:3562:19: warning: passing NULL to non-pointer argument 5 of ‘melbourne::NODE* melbourne::node_newnode(melbourne::rb_parse_state*, melbourne::node_type, VALUE, VALUE, VALUE)’ | |
grammar.y: In function ‘int melbourne::mel_yylex(void*, void*)’: | |
grammar.y:3818:23: warning: passing NULL to non-pointer argument 5 of ‘melbourne::NODE* melbourne::node_newnode(melbourne::rb_parse_state*, melbourne::node_type, VALUE, VALUE, VALUE)’ | |
grammar.y:3833:23: warning: passing NULL to non-pointer argument 5 of ‘melbourne::NODE* melbourne::node_newnode(melbourne::rb_parse_state*, melbourne::node_type, VALUE, VALUE, VALUE)’ | |
grammar.y:3838:23: warning: passing NULL to non-pointer argument 5 of ‘melbourne::NODE* melbourne::node_newnode(melbourne::rb_parse_state*, melbourne::node_type, VALUE, VALUE, 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
body = driver.find_element(:tag_name => "body") | |
dom = driver.execute_script("return new XMLSerializer().serializeToString(arguments[0])", body) |