Skip to content

Instantly share code, notes, and snippets.

View samaaron's full-sized avatar

Sam Aaron samaaron

View GitHub Profile
obj.registerMethod(obj.runtime.newJavaMethod("compares this symbol against the argument, returning -1, 0 or 1 based on which one is lexically larger", new TypeCheckingJavaMethod("<=>") {
private final TypeCheckingArgumentsDefinition ARGUMENTS = TypeCheckingArgumentsDefinition
.builder()
.receiverMustMimic(obj.runtime.symbol)
.withRequiredPositional("other")
.getArguments();
@Override
public TypeCheckingArgumentsDefinition getArguments() {
return ARGUMENTS;
obj.registerMethod(obj.runtime.newJavaMethod("compares this symbol against the argument, returning -1, 0 or 1 based on which one is lexically larger", new TypeCheckingJavaMethod("<=>") {
private final TypeCheckingArgumentsDefinition ARGUMENTS = TypeCheckingArgumentsDefinition
.builder()
.receiverMustMimic(obj.runtime.symbol)
.withRequiredPositional("other")
.getArguments();
@Override
public TypeCheckingArgumentsDefinition getArguments() {
return ARGUMENTS;
AnagramFinder = Origin mimic do(
Multimap = Origin mimic do(
initialize = method(self content = {})
cell("[]=") = method(key, value,
if(content key?(key),
content[key] << value,
content[key] = DefaultBehavior[value]))
[] = method(key,
content[key])
keys = method(
Ruby describes itself as a dynamic programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write. It is these assets that allow beginners to quickly become acquainted with and effective in using the language. However, it is Ruby's flexibility and remarkably dynamic nature that enables experts to harness its true power. It is this power which is at the heart of Ruby's success stories such as Ruby on Rails, RSpec and Sinatra.
This tutorial will provide an overview of the advanced concepts within Ruby. Together we will tour through the essence of what makes Ruby so flexible and dynamic. We will explore the power of open classes, meta-classes and modules and take a look at some of Ruby's many useful hook methods through the use of a series of examples. For those interested in interoperability we will also look at communicating with other languages such as C, Java and Objective-C. Finally, we will bring many of these concepts together and ex
List join = method(
"returns a string created by converting each element of the array to text, separated by an optional separator",
separator "",
self[0..-2] inject("", sum, x, sum + x asText + separator) + self[-1] asText)
1) when given no id should redirect FAILED:
[./test/functional/challenges_controller_test.rb:433:in `__bind_1234261799_596034'
/Users/sam/innovationfactory/suite/dev/ideaman/vendor/plugins/shoulda/lib/shoulda/context.rb:254:in `call'
/Users/sam/innovationfactory/suite/dev/ideaman/vendor/plugins/shoulda/lib/shoulda/context.rb:254:in `test: when given no id should redirect. '
/Users/sam/innovationfactory/suite/dev/ideaman/vendor/rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:60:in `__send__'
/Users/sam/innovationfactory/suite/dev/ideaman/vendor/rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:60:in `run']:
Expected response to be a redirect to <http://test.host/> but was a redirect to <http://test.host/challenges>.
2) when logged in creating a new news item should save with a POST FAILED:
[user]
name = Sam Aaron
email = samaaron@gmail.com
[alias]
switch = checkout
s = checkout
b = branch
i = status
c = commit
[color]
naeu_: does anyone in here feel up for explaining the difference between lexical scopes and bindings?
[21:46] naeu_: i.e. how this works: x = 1; proc { y = 2; proc { puts [x,y] }}
[21:47] headius: lopex: I wish there were more specs for 1.9
[21:47] headius: naeu_: a binding aggregates a lexical scope and some other stuff
[21:47] headius: a proc is essentially a captured binding plus a block of code
[21:47] headius: lexical scope is simply a hierarchy of variable scopes and some other stuff
[21:48] naeu_: so the code snippet i wrote just now is an example of a two-tiered hierarchy of variable scopes?
[21:48] headius: that's right
[21:48] david_koontz: headius: any ideas on the stack out of memory error I posted earlier?
[21:48] headius: well, three actually
∴ /Users/sam/Development/ioke
λ ant
Buildfile: build.xml
prepare:
[mkdir] Created dir: /Users/sam/Development/ioke/build
[mkdir] Created dir: /Users/sam/Development/ioke/build/coverage
[mkdir] Created dir: /Users/sam/Development/ioke/build/classes
[mkdir] Created dir: /Users/sam/Development/ioke/src/generated/ioke/lang/parser
∴ /Users/sam/Development/ioke
λ git pull ; ant clean ; ant
remote: Counting objects: 9, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 5 (delta 3), reused 0 (delta 0)
Unpacking objects: 100% (5/5), done.
From git://github.com/olabini/ioke
f94c12c..cbe06dc master -> origin/master
Updating f94c12c..cbe06dc
Fast forward