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
<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:xdb="http://orbeon.org/oxf/xml/xmldb" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:oxf="http://www.orbeon.com/oxf/processors"> | |
<p:param name="instance" type="input" debug="model in"/> | |
<p:param name="data" type="output" debug="model out"/> | |
<p:processor name="oxf:request"> | |
<p:input name="config"> | |
<config> | |
<include>/request/parameters/*</include> | |
</config> |
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
SSH_ENV="$HOME/.ssh/environment" | |
function start_agent { | |
echo "Initialising new SSH agent..." | |
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}" | |
echo succeeded | |
chmod 600 "${SSH_ENV}" | |
. "${SSH_ENV}" > /dev/null | |
/usr/bin/ssh-add; | |
} | |
# Source SSH settings, if applicable |
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
class String | |
# 'hello' ^ ' ' => 'HELLO' | |
def ^ s2 | |
to_byte_array.zip(s2.to_byte_array).map { |s| s[0] ^ s[1] if s[1] }.reject(&:nil?).pack('C*') | |
end | |
# '68656c6c6f20776f726c64' => 'hello world' | |
def hex_string_to_binary_string | |
[self].pack 'H*' | |
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
--- | |
months: | |
0: | |
- name: Mardi Gras | |
regions: [bank] | |
function: easter(year)-47 | |
11: | |
- name: Black Friday | |
week: -1 | |
regions: [bank] |
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
require 'faker' | |
require 'benchmark' | |
times = 10000000 | |
str = 'hello world' | |
Benchmark.bm do |b| | |
b.report("+ with space") do | |
times.times do | |
str + str | |
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
require 'perftools' | |
TIMES = 100_000 | |
Benchmark.bm do |bm| | |
bm.report 'FactoryGirl.build' do | |
PerfTools::CpuProfiler.start("factorygirl") do | |
TIMES.times { FactoryGirl.build :loans_search_form } | |
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
describe "show foo" do | |
let(:foo) { FactoryGirl.create :foo } | |
it "should load" do | |
visit foo_path(foo) | |
page.path.should == foo_path | |
page.status_code.should == 200 | |
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
/vagrant/test_spec.rb:3:in `block in <top (required)>': undefined local variable or method `foo' for #<Class:0x000000020035c8> (NameError) | |
from /usr/local/rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.1/lib/rspec/core/example_group.rb:244:in `module_eval' | |
from /usr/local/rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.1/lib/rspec/core/example_group.rb:244:in `subclass' | |
from /usr/local/rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.1/lib/rspec/core/example_group.rb:230:in `describe' | |
from /usr/local/rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.1/lib/rspec/core/dsl.rb:18:in `describe' | |
from /vagrant/test_spec.rb:1:in `<top (required)>' | |
from /usr/local/rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.1/lib/rspec/core/configuration.rb:789:in `load' | |
from /usr/local/rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.1/lib/rspec/core/configuration.rb:789:in `block in load_spec_files' | |
from /usr/local/rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.1/lib/rspec/core/configuration.rb:789:in `each' | |
from /usr/local/rvm/gems/r |
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
// LPD8806 LED Code for our Yacht Club's Anchor | |
/*************************************************************************************/ | |
#include "LPD8806.h" // Library Here: https://github.com/adafruit/LPD8806 | |
#include "SPI.h" | |
int totalLEDs = 14; | |
int dataPin = 2; | |
int clockPin = 3; | |
LPD8806 strip = LPD8806(totalLEDs, dataPin, clockPin); |
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
https://twitter.com/garybernhardt/status/349920138889404416 | |
[1] pry(main)> class Object; alias_method :&, :method; end | |
=> Object | |
With standard symbol to proc, &:foo evaluates to: | |
{ |x| x.foo } | |
With the "pretzel bun", &foo&:bar evaluates to: |