Skip to content

Instantly share code, notes, and snippets.

View jaredfolkins's full-sized avatar
🧂
💡

Jared Folkins jaredfolkins

🧂
💡
View GitHub Profile
A few examples will help to clarify these operations. Let's begin by creating two arrays:
operating_systems = ["Fedora", "SuSE", "RHEL", "Windows", "MacOS"]
linux_systems = ["RHEL", "SuSE", "PCLinuxOS", "Ubuntu", "Fedora"]
Now, we can create a union of the two arrays:
operating_systems | linux_systems
=> ["Fedora", "SuSE", "RHEL", "Windows", "MacOS", "PCLinuxOS", "Ubuntu"]
Failure/Error: document.nokogiri_document.should be_a_kind_of(Nokogiri)
expected #<Nokogiri::HTML::Document:0x8041d478 name="document" children=[#<Nokogiri::XML::DTD:0x80a01a24 name="html">, #<Nokogiri::XML::Element:0x80b02a2c name="html">]> to be a kind of Nokogiri
describe "#create_nokogiri_object" do
it "if supplied document is not a nokogiri object" do
document = DeschutesDocument.new('<html>')
document.nokogiri_document.should be_a_kind_of(Nokogiri)
end
end
def save_deed_and_related_documents(deed)
unless deed.make_reference.nil?
deed.make_reference.each do | reference |
puts reference
end
end
end
def save_deed_and_related_documents(deed)
unless deed.make_reference.nil?
deed.make_reference.each do | reference |
deed.each do | record |
puts record
end
end
end
end
def save_deed_and_related_documents(deed)
unless deed.make_reference.nil?
deed.make_reference.each do | reference |
reference.each do | record |
puts record
end
end
end
end
@jaredfolkins
jaredfolkins / robot.js
Created December 7, 2012 00:00 — forked from f6p/robot.js
NecroBadger
// helpers
function areEnemies(robot, sighted) {
var sightedIsChild = (robot.id == sighted.parentId);
var sightedIsParent = (robot.parentId == sighted.id);
return !(sightedIsChild || sightedIsParent);
};
function baseStep(robot) {
Traceback (most recent call last):
File "/home/elvis/emscripten/emcc", line 1272, in <module>
flush_js_optimizer_queue()
File "/home/elvis/emscripten/emcc", line 1222, in flush_js_optimizer_queue
final = shared.Building.js_optimizer(final, js_optimizer_queue, jcache)
File "/home/elvis/emscripten/tools/shared.py", line 1057, in js_optimizer
return js_optimizer.run(filename, passes, NODE_JS, jcache)
File "/home/elvis/emscripten/tools/js_optimizer.py", line 179, in run
return temp_files.run_and_clean(lambda: run_on_js(filename, passes, js_engine, jcache))
File "/home/elvis/emscripten/tools/shared.py", line 435, in run_and_clean
func ShowCris(fname string, lname string) (string, error) {
res, err := DoSomethingAmazing(fname,lname)
if err != nil {
Panic(err)
}
return res, nil
}
@jaredfolkins
jaredfolkins / setup_test.go
Last active August 29, 2015 14:16
TestMain() Pattern
// Because TestMain() is an init method and should (in most cases) only be called once, one must wrap it to extend the functionality
//
// 1. This code should exist in a setup_test.go (descriptive name) file
// 2. Setup/Teardown methods along with variables/connections/assets for specific tests should be written inside of the specific test file
// Example Filename: some_random_test.go
// Setup Method: someRandomTestSetup()
// Teardown Method: someRandomTestTeardown()
// 3. The Setup/Teardown methods are added to the global testMainSetup()/testMainTeardown() to centralize and organize your test suite
package proj