View enumerator_to_json.rb
1 2 3 4 5 6 7 8 9 10
# Natively, Enumerators get JSONized like "#<Enumerator::Lazy:0x007f8714807080>", or they explode, either of which is a problem.
# We want them to make an array, and do it lazily so we don't have to keep the items in memory!
class Enumerator
def to_json(state)
state.depth += 1
string = "[\n"
first_item = true
self.each do |item|

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style


The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.


Based on the 'successful' build, I think this PR is sufficient as is. I'll create new PR's for specific JRuby issues.

Travis results summary


test/railties/railtie_test.rb Run options: --seed 40836 Running: ...............

View ruby_queues_are_essentially_go_channels.rb
1 2 3 4 5 6 7 8 9 10
# Apparently this has been in Ruby since 1.9.3... who knew?
# Also check out sized queue class
require 'thread'
# Create a new thread that blocks on queue pop
# Create an "exit" channel to send "stop" message when total of 100 is reached
View vaportrails.rb
1 2 3 4 5 6 7 8 9 10
#!/usr/bin/env ruby
# Print the vaportrail of a ruby file in a git repo, i.e.,
# the complexity level at each commit.
# Requires: >= bash ?.?
# >= git 1.7.1
# >= ruby 1.9.2
# >= flog 2.5.0
sudo apt-get install libssl-dev zlib1g zlib1g-dev libreadline-dev bison
# cp rbenv_install.bash /usr/local/rbenv_installer.bash
sudo chgrp sudo /usr/local/rbenv_installer.bash
sudo chmod g+rwxXs /usr/local/rbenv_installer.bash
# cp /etc/profile.d/
sudo chmod +x /etc/profile.d/
source /etc/profile.d/
# cp default-gems /usr/local/rbenv/default-gems
View email_address_validator.rb
1 2 3 4 5 6 7 8 9 10
require 'mail'
require 'resolv'
require 'net/telnet'
class EmailAddressValidator < ActiveModel::EachValidator
attr_reader :mail
def validate_each(record, attribute, value)
return if options[:allow_nil] && value.nil?
View GithubEventAnalysisWithNeo4j.markdown

Github Events Analysis with Neo4j


On July 22, Github announced the 3rd Annual Github Data Challenge presenting multiple sources of data available.

This sounded to me a good opportunity to use their available data and import it in Neo4j in order to have a lot of fun at analyzing the data that fits naturally in a graph.

As I work mainly offline or behind military proxies that do not permit me to use the ReST API, I decided to go for the Github Archive available here, you can then download json files representing Github Events on a daily/hour basis.

Something went wrong with that request. Please try again.