Results from the 2013-02-18 Dayton Clean Coders Command Line Kata
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
var bgcolorlist = ["#DFDFFF", "#FFFFBF", "#80FF80", "#EAEAFF", "#C9FFA8", "#F7F7F7", "#FFFFFF", "#DDDD00"]; | |
document.body.style.background=bgcolorlist[Math.floor(Math.random()*bgcolorlist.length)]; |
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
# hello_world.rb | |
require 'rack' | |
require 'rack/server' | |
class HelloWorldApp | |
def self.call(env) | |
[ 200, {}, ['Hello World'] ] | |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
# Step 1: Download this zip: https://github.com/daytoncleancoders/projects/raw/master/commandline/command-line-kata.zip | |
# (mac/nix hint: curl, wget) | |
# (windows hint: net.webclient) | |
if [ ! -d "site" ] | |
then | |
curl -O https://raw.github.com/daytoncleancoders/projects/master/commandline/command-line-kata.zip | |
# Step 2: Extract the zip | |
# (hint: tar) |
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 blah | |
yield 1 | |
p "2 coming" | |
yield 2 | |
end | |
blah { |x| p x } |
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 pmap(enum) | |
return to_enum(:pmap, enum) unless block_given? | |
enum.each_with_index.map { |e,i| Thread.new { sleep(Random.rand); p e; yield ({index: i, value:e }) } }.map(&:value) | |
end | |
p to_enum(:pmap, 1..10).sort_by { |hash| hash[:index] }.map { |hash| hash[:value] } | |
#p pmap(1..10) { |x| x } |
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_relative 'dice' | |
require 'minitest/spec' | |
require 'minitest/autorun' | |
describe Dice do | |
before do | |
@new_roll = Dice.new | |
end | |
describe "rolling 5 dice" do |
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
jsWarrior.turn = function(warrior) { | |
enhance(warrior); | |
actions = [ attack_move, heal_move, walk_move ]; | |
available_actions = actions.filter( function(action) { return action.can(warrior); } ); | |
available_actions[0].act(warrior); | |
warrior.last_health = warrior.getHealth(); |
I hereby claim:
- I am cromwellryan on github.
- I am cromwellryan (https://keybase.io/cromwellryan) on keybase.
- I have a public key whose fingerprint is E31F A201 E2FA 4C3F A9DC 282F 544D 252A 05BE B4C3
To claim this, I am signing this object:
OlderNewer