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
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"time" | |
) | |
type Conn struct { | |
num int |
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
diff --git a/lib/psych/handlers/document_stream.rb b/lib/psych/handlers/document_stream.rb | |
index e429993..25d10fb 100644 | |
--- a/lib/psych/handlers/document_stream.rb | |
+++ b/lib/psych/handlers/document_stream.rb | |
@@ -18,5 +18,19 @@ module Psych | |
@block.call pop | |
end | |
end | |
+ | |
+ class StrictDocumentStream < DocumentStream |
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
#!/bin/bash | |
set -e | |
#!/bin/bash | |
set -e | |
ansible $@ -i .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory --private-key=~/.vagrant.d/insecure_private_key -u vagrant |
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 Cell | |
def self.random | |
number = Random.rand(100) | |
if number > 50 | |
live | |
else | |
dead | |
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
class Cell | |
CHARACTERS = { :live => 'X', :dead => 'O' } | |
attr_reader :live | |
def self.live | |
new(:live) | |
end | |
def self.dead |
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 evolve_cell(cell, neighbours) | |
if cell == 1 | |
if neighbours.inject(&:+) == 2 || neighbours.inject(&:+) == 3 | |
1 | |
else | |
0 | |
end | |
else | |
if neighbours.inject(&:+) == 3 | |
1 |
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
#!/bin/bash | |
set -e | |
cp previous.key intermediate.key | |
cp current.key previous.key | |
mv intermediate.key current.key | |
service nginx reload |
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 'active_record' | |
require 'logger' | |
ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:' | |
ActiveRecord::Base.connection.instance_eval do | |
create_table(:starting_goalies) do |t| | |
t.string :status | |
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
class Optional | |
private_class_method :new | |
def self.maybe(possible) | |
possible.nil? ? absent : of(possible) | |
end | |
def self.absent | |
None.new | |
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
Run options: --seed 53381 | |
# Running: | |
. | |
Finished in 0.000873s, 1145.2393 runs/s, 1145.2393 assertions/s. | |
1 runs, 1 assertions, 0 failures, 0 errors, 0 skips |
OlderNewer