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
# Return default values for important properties | |
def self.defaults | |
{ | |
:status => 'active', | |
:root => URINode.new(:name => '__root__'), | |
:taxonomy => TaxonomyNode.new(:name => '__taxonomy__'), | |
} | |
end | |
def init_on_create(*args) |
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
# When `person` is initialized, even if it's only set to nil, then the | |
# value is shared both inside and outside the block: | |
person = nil | |
Neo4j::Transaction.run do |tx| | |
person = Person.new(params) | |
puts "Inside block, person: #{person}" | |
end | |
puts "Outside block, person: #{person}" |
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
# SUMMARY | |
# This gist shows a performance test between a few different variations of Selenium, | |
# running against Rsel's unit-test sinatra site (https://github.com/a-e/rsel) | |
# It repeats these steps 20 times: | |
# | |
# - Click "About this site" link | |
# - Go back to the homepage | |
# - Click "Form test" link |
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
# ~/git/rsel $ ruby perf/simple-client.rb | |
# Loop time: 10.555982s | |
# Total time: 18.245965s | |
# ~/git/rsel $ ruby perf/simple-webdriver.rb | |
# Loop time: 18.025064s | |
# Total time: 24.989934s | |
# perf/simple-client.rb |
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
describe "pages vs. outgoing(:pages)" do | |
it "isn't the same thing" do | |
Neo4j::Transaction.run do | |
puts "@uri_node.pages: #{@uri_node.pages.inspect}" | |
puts "@uri_node.outgoing(:pages): #{@uri_node.outgoing(:pages).inspect}" | |
puts | |
puts "Appending a page to @uri_node.pages..." | |
page = Page.new(:name => 'mypage') | |
@uri_node.pages << page | |
puts |
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
# Return true if we're inside a conditional block, false otherwise. | |
# | |
def in_conditional? | |
return @conditional_stack.length > 1 | |
end | |
# Return true if we're inside a true conditional block (one that | |
# evaluated true and should be executed). | |
# | |
def in_true_conditional? |
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
# Enter text in a tinymce editor widget. +iframe_id+ is the | |
# HTML id of the +iframe+ element containing the editor. | |
def fill_in_tinymce(iframe_id, text) | |
within_frame(iframe_id) do | |
editor = page.find_by_id('tinymce').native | |
editor.send_keys(text) | |
end | |
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 foo(var, hash1={}, hash2={}) | |
puts "var: #{var.inspect}" | |
puts "hash1: #{hash1.inspect}" | |
puts "hash2: #{hash2.inspect}" | |
end | |
> foo('x', 'y', 'z') | |
var: "x" | |
hash1: "y" | |
hash2: "z" |
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
$ nosetests -v | |
PySciSettings widget can be instantiated. ... ok | |
clear() empties the buffer. ... ok | |
modified() retrieves the isModified flag. ... ok | |
modified(flag) sets the isModified flag. ... ok | |
Basic configuration settings are applied. ... ok | |
Color configuration is correctly applied. ... ok | |
Custom attribute-getters return correct values. ... ok | |
Enumeration-based configuration is correctly applied. ... ok | |
Enumeration string-based configuration is correctly applied. ... ok |
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
{ | |
"data" => { | |
"subscribers" => "" #CSV list | |
}, | |
"payload" => { | |
"after" => "fe5c43825be82e9b7abec988a2520ad3a8f65c93", | |
"ref" => "refs/heads/master", | |
"before" => "0fc04841e10d032281ee961a566190deb59c613e", |