Skip to content

Instantly share code, notes, and snippets.

View saterus's full-sized avatar

Alex Burkhart saterus

View GitHub Profile
[11] pry(main)> module M
[11] pry(main)* def foo
[11] pry(main)* puts "self: #{self}"
[11] pry(main)* end
[11] pry(main)* end
=> nil
[12] pry(main)> class C
[12] pry(main)* include M
[12] pry(main)* end

API Evolution Kata

Today's Kata will evolve a simple API from both the server and the client point of view. The end goal is to produce an API for crafting delicious, delicious burritos.

You will need a pair for this. One person will be writing the server and one person will be writing the client. This will let us evolve our API quickly and require both people to make the appropriate changes. Luckily, Hyper can play both roles!

[1] pry(main)> module Foo
[1] pry(main)* def self.included(base)
[1] pry(main)* base.instance_exec do
[1] pry(main)* define_method :foo do
[1] pry(main)* puts "foo!"
[1] pry(main)* end
[1] pry(main)* end
[1] pry(main)* end
[1] pry(main)* end
=> nil
module Foo
def instance_foo
puts "called instance_foo"
end
def self.classy_foo
puts "called classy_foo"
end
end
@saterus
saterus / rust_dice_kata.md
Last active August 29, 2015 14:25
Rust Dice Rolling Kata

Dice Roller

Goal

Take a simple idea, package it up in different ways.

Get experience with:

* Cargo
  • Tests

Custom Curriculum

  • Short, focused classes
  • Clear goals from the outset
  • Measurable progress & outcomes
  • Tangible takeaways

Subjects

  • Ruby
START user=node(Z)
MATCH (user)-[:LIKES]->(y)
WHERE y.classname = 'Discussion'
RETURN y;
- Alex Burkhart
- @Saterus
- neo.com
BASICS:
- REPL
- Ruby Classic: IRB
- ****gem install pry-plus****
@saterus
saterus / gist:5760177
Created June 11, 2013 20:09
Neo4j.rb Unique Relationships
class Novel < Neo4j::Rails::Model
property :title, type: String, index: :exact
has_n(:authored_by).to(Author)
end
class Author < Neo4j::Rails::Model
property :name, type: String, index: :exact
For my ((a family member))'s ((an event)) present about ((a number)) years ago,
I got him a ((gift:a noun)). Not a ((an adjective)) ((gift)) or a loud one or
even a ((an adjective)) ((gift)) that runs around chasing its ((a body part))
and drooling on the ((a noun)). I got them a ((a proper noun)), bred in China
thousands of years ago to be the ((a plural noun)) of the royal family. We
named it ((a proper name)).