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 | |
DATA_BAGS=data_bags/users/* | |
for f in $DATA_BAGS | |
do | |
knife data bag from file users $f --secret-file .chef/encrypted_data_bag_secret | |
done |
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
<html> | |
<head> | |
<link rel='stylesheet' href='fullcalendar/fullcalendar.css' /> | |
</head> | |
<body> | |
<div id='calendar'> | |
</div> | |
<script src='lib/jquery.min.js'></script> | |
<script src='lib/jquery-ui.custom.min.js'></script> |
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 BowlingGame | |
attr_accessor :scorecard | |
def score | |
@scorecard.size.times.map { |i| frame_score(@scorecard[i, 3]) }.reduce(:+) | |
end | |
def frame_score(frames) | |
if strike_or_spare?(frames.first) | |
frames.flatten.first(3).reduce(:+) | |
else |
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' | |
#all gutters -> 0 | |
#scores twenty with one pin knocked down every roll | |
#spare in frame 1 followed by 3 pins = 16 | |
#strike -> 3-> 4 = 24 | |
#perfect game -> 300 | |
class BowlingGame | |
attr_reader :scorecard | |
def initialize |
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' | |
# input: integer (0-100) | |
# output: hash, e.g. | |
# 5 -> {quarters: 0, dimes: 0, nickels: 1, pennies: 0} | |
# 12 -> {quarters: 0, dimes: 1, nickels: 0, pennies: 2} | |
# describe "#make_change" do | |
# before { | |
# @change_maker = AmericanChangeMaker.new(ChangeMaker) |
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' | |
# input: integer (0-100) | |
# output: hash, e.g. | |
# 5 -> {quarters: 0, dimes: 0, nickels: 1, pennies: 0} | |
# 12 -> {quarters: 0, dimes: 1, nickels: 0, pennies: 2} | |
describe "#make_change" do | |
it "1 should return 1 penny" do | |
expect(make_change(1)).to eq(quarters: 0, dimes: 0, nickels: 0, pennies: 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
require 'rspec' | |
def from_roman(roman) | |
if roman.include? "X" | |
roman[0] == "X" ? 10 * roman.count("X") + ones(roman) : 9 | |
else | |
ones(roman) | |
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
require 'rspec' | |
class Game | |
attr_reader :player1, :player2 | |
def initialize | |
@player1 = Player.new('player 1') | |
@player2 = Player.new('player 2') | |
@score_view = ScoreView.new(self) | |
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
require 'rspec' | |
class Game | |
attr_reader :player1, :player2 | |
POINTS = [0, 15, 30, 40] | |
def initialize | |
@player1 = Player.new('player1') | |
@player2 = Player.new('player2') | |
@point = Point.new(@player1, @player2) | |
@score_view = ScoreView.new(@player1, @player2) |
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' | |
def get_score(game) | |
bonus_tally = [] | |
counter = 0 | |
while counter < game.length | |
if game[counter] == 10 | |
scores_to_add = [game[counter + 1], game[counter + 2]] | |
bonus_tally += scores_to_add unless scores_to_add.any?(&:nil?) |
NewerOlder