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
// BAKER BOT | |
// | |
// This bot will bake bread and then drop it all | |
// off in the beacon. Build an oven and give the | |
// bot lots of grain and wood. | |
// go to the oven | |
moveto(oven); | |
// bake bread until we run out of ingredients |
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
$:.unshift "lib" | |
require "mustache" | |
require "benchmark/ips" | |
BASE_TEMPLATE = <<end_of_template | |
<h2>Names</h2> | |
{{#names}} | |
{{> user}} | |
{{/names}} |
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 Enumerator | |
def concat(other) | |
new_size = size && other.size && size + other.size | |
Enumerator.new(new_size) do |yielder| | |
each { |element| yielder << element } | |
other.each { |element| yielder << element } | |
end | |
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
function ssh-govuk-dev { | |
if [[ $PWD = ~/code/gds/* ]]; then | |
ssh dev -t "cd /var/govuk/$(basename $PWD); bash --login" | |
else | |
ssh dev | |
fi | |
} |
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 'rspec' | |
RSpec.describe Object do | |
subject { Object.new } | |
before do | |
# Stub a method so we can spy on it | |
allow(subject).to receive(:a_method) | |
# Call it twice with alpha and once with beta |
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
$LegislativeList | |
1. The | |
quick | |
2. Brown fox | |
a) Jumps | |
over | |
ii) Foo | |
iv) Bar | |
viii) Baz | |
b) The lazy |
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
{ | |
"title": "Immigration Rules Updates", | |
"slug": "guidance/immigration-rules/updates", | |
"kind": "manual-change-notes", | |
"details": { | |
"manual_slug": "guidance/immigration-rules", | |
"updates": [ | |
{ | |
"published_at": "2014-04-01T12:30:00", | |
"slug": "guidance/immigration-rules/document-slug", |
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
[alias] | |
amend = commit --amend -C HEAD | |
c = commit | |
cm = commit -m | |
co = checkout | |
d = diff --no-prefix | |
dc = diff --no-prefix --cached | |
f = fetch --prune | |
ff = merge --ff-only | |
ignore = !([ ! -e .gitignore ] && touch .gitignore) | echo $1 >> .gitignore |
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 'rspec/autorun' | |
module DominicRecursion | |
def self.letters(haystack, needles, index = 0) | |
# base case: if the letters to match are empty, we've succeeded | |
return [[]] if needles.empty? | |
# base case: if the word to match in is empty, we've failed | |
return [] if haystack.empty? |
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 Bezier | |
TOLERANCE = 0.5 ** 8 | |
def initialize(control_points) | |
@control_points = control_points | |
end | |
def points | |
@points ||= build_points | |
end |
NewerOlder