This file contains hidden or 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 attribute(name, options = {}) | |
class_eval <<-EOS, __FILE__, __LINE__ | |
def #{name} | |
attributes[:#{name}] | |
end | |
EOS | |
case options[:type] | |
when :boolean | |
class_eval <<-EOS, __FILE__, __LINE__ | |
def #{name}=(new_#{name}) |
This file contains hidden or 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
constant = collection.to_s.split('_').map {|characters| characters[0...1].upcase << characters[1..-1]}.join('') |
This file contains hidden or 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
(depends-on "magit") | |
(depends-on "smex") | |
(depends-on "popup") | |
(depends-on "auto-complete") | |
(depends-on "ruby-end") |
This file contains hidden or 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 'rubygems' | |
require 'shindo' | |
Shindo.tests('something') do | |
test('pending') # pending | |
test('truthyness') { true } # passes | |
test('failure') { false } # fails | |
end |
This file contains hidden or 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
gimme_a_client_in_mah(Context) when Context#ctx.client == undefined -> | |
{ok, Client} = riakc_pb_socket:start_link(?RIAK_NAME, ?RIAK_PB_PORT), | |
Context#ctx{client = Client}. | |
gimme_a_client_in_mah(Context) -> | |
Context. |
This file contains hidden or 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
gimme_a_client_from(Context) when Context#ctx.client == undefined -> | |
{ok, Client} = riakc_pb_socket:start_link(?RIAK_NAME, ?RIAK_PB_PORT), | |
Client; | |
gimme_a_client_from(Context) -> | |
C -> C. |
This file contains hidden or 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
gimme_a_client_from(Context) -> | |
case Context#ctx.client of | |
undefined -> | |
{ok, Client} = riakc_pb_socket:start_link(?RIAK_NAME, ?RIAK_PB_PORT), | |
Client; | |
C -> C | |
end. |
This file contains hidden or 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
{webmachine, [ | |
{log_handlers, [ | |
{webmachine_log_handler, ["log"]} | |
]} | |
]}, |
This file contains hidden or 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
neighbor_coords({ X, Y }, Grid) -> | |
[ { NX, NY } || | |
NX <- [ X - 1, X, X + 1 ], | |
NY <- [ Y - 1, Y, Y + 1 ], | |
{ NX, NY } /= { X, Y }, | |
NX > 0, NY > 0, | |
NX =< length(Grid), NY =< length(Grid) ]. | |
This file contains hidden or 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
neighbor_coords(X, Y) -> | |
[ { NX, NY } || | |
NX <- [ X - 1, X, X + 1 ], | |
NY <- [ Y - 1, Y, Y + 1 ], | |
{ NX, NY } /= { X, Y } ]. |