Skip to content

Instantly share code, notes, and snippets.

View practicingruby's full-sized avatar

Gregory Brown practicingruby

View GitHub Profile
2012-04-02: Work on PuzzleNode "Secret Messages" problem
Link: https://github.com/sandal/puzzlenode-solutions/compare/9070...3b79
>> File.foreach("/usr/share/dict/words").find { |l| l =~ /^apple$/i }.chomp
=> "apple
Tempted to provide a fake dictionary file, but YAGNI? (could have been an
alternate way to deal with performance)
Time spent on test boilerplate noticeably tedious and boring. Hard to maintain
x = "awesome"
begin
puts "A"
puts "B"
end if x == "awesome"
>> class A
>> def initialize(&block)
>> block.call
>> end
>> def foo
>> puts "hi"
>> end
>> end
=> nil
>> A.new { foo }
Our beloved Ruby
1.1
1.2
1.8
1.9
1.10
1.10.A
1.11
2.1
require 'ray'
require 'io/console'
Ray.game "Test" do
register { add_hook :quit, method(:exit!) }
scene :square do
self.frames_per_second = 5
@sound = Ray::Sound.new("Beep.wav")
@sound.pos = [rand(20..40), rand(20..40),0]
@practicingruby
practicingruby / testing.md
Created May 3, 2012 13:53
Questions for drbrain

QUESTION 1: Is there a better way to test that callbacks are being called?

  it "must trigger an event when the danger zone is reached" do
    alert = false

    game.on_event(:enter_region, :danger_zone) { alert = true }
    game.on_event(:leave_region, :danger_zone) { alert = false }

    refute alert, "should not enable alert before danger zone is reached"
class Point
def self.random(distance_range, randomizer=Random.new)
angle = randomizer.rand(0..2*Math::PI)
length = randomizer.rand(distance_range)
x = length*Math.cos(angle)
y = length*Math.sin(angle)
point = new(x, y)
center = new(0, 0)
seacreature: Hi everyone, we'll get started in a just a couple minutes 05:32 PM
seacreature: We also have some big news: We are starting the transition to making Mendicant a fully public community / school: https://github.com/mendicant/mendicantuniversity.org/wiki/Mendicant-University-roadmap 05:33 PM
seacreature: drbrain: I'll start hitting you with questions in like two minutes, putting in a food order right now so I don't forget to eat dinner :) 05:35 PM
drbrain: seacreature: awesome 05:36 PM
seacreature: For everyone else, what we're about to do is have drbrain review some of my code and questions about test-driven development. 05:36 PM
seacreature: I am currently doing a 90 day self-study in TDD and as part of that I promised to try to fill in my own holes in understanding where possible 05:36 PM
seacreature: the task of working on a simple little game lately proved to be very annoying for me testing wise, and so that's what we'll be talking about today 05:37 PM
seacreature: if you're not

Transcript from a test-driven development dialogue between Gregory Brown (seacreature) and Eric Hodel (drbrain) in the #mendicant IRC channel (2012 May 03)

seacreature: Hi everyone, we'll get started in a just a couple minutes 05:32 PM

seacreature: We also have some big news: We are starting the transition to making Mendicant a fully public community / school: https://github.com/mendicant/mendicantuniversity.org/wiki/Mendicant-University-roadmap 05:33 PM

seacreature: drbrain: I'll start hitting you with questions in like two minutes, putting in a food order right now so I don't forget to eat dinner :) 05:35 PM

drbrain: seacreature: awesome 05:36 PM

---
title: "The Unicorn's Horn, Issue #1"
category: updates
layout: post
tags: frontpage
---
> The Unicorn's Horn is a weekly summary of what we have been up to lately at Mendicant University. It should come in handy for folks who want to keep up with what we are working on, but don't have time to read each and every one of our updates.
It's hard to believe how quickly time passes: A week ago Mendicant University was still a private community, but now all of our efforts are focused on tearing down those walls. We have made some great progress over the last few days, and next week is looking like it will be even better.