Skip to content

Instantly share code, notes, and snippets.

View anildigital's full-sized avatar
:octocat:

Anil Wadghule anildigital

:octocat:
View GitHub Profile

Notes on teaching both test/unit and RSpec to new Ruby developers

@tenderlove asked "Is it good to teach RSpec (vs t/u) to people who are totally new to Ruby?" I have experience suggesting that it is a good thing; after a short back and forth, it seemed useful to write it up in detail.

Background

This goes back several years, to when I was the primary Ruby/Rails trainer for Relevance from 2006-2009. I'm guessing that worked out to probably 6-8 classes a year during those years. Since then, RSpec has changed a fair amount (with the addition of expect) and test/unit has changed radically (it has an entirely new implementation, minitest, that avoids some of the inconsistencies that made test/unit a bit confusing during the time I'm writing about here).

I started out as an RSpec skeptic. I've never been afraid of what a lot of people denigrate as "magic" in Ruby libraries … to me, if you take the trouble to understand it, that stuff's just pr

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.

@anildigital
anildigital / README.md
Last active August 29, 2015 14:05 — forked from tommaybe/LICENSE.md

Inspired by Trulia Trends - but with code and using SVG.

Example data shows concurrent user sessions over time, taken from a development environment.

@anildigital
anildigital / 0_reuse_code.js
Last active August 29, 2015 14:24
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@anildigital
anildigital / pless.sh
Created November 12, 2008 17:34 — forked from defunkt/pless.sh
# my new favorite bashrc function
# quickly inspect source files in style
function pless {
pygmentize $1 | less -r
}
class Array
def second
self[1]
end
end
@anildigital
anildigital / gist:28382
Created November 24, 2008 04:56 — forked from lifo/gist:23541
require 'rubygems'
require 'ruby-prof'
RubyProf.measure_mode = RubyProf::PROCESS_TIME
RubyProf.start
require 'config/environment'
results = RubyProf.stop
File.open "loading-graph.html", 'w' do |file|
RubyProf::GraphHtmlPrinter.new(results).print(file)
@anildigital
anildigital / .vimrc
Created November 26, 2008 20:59 — forked from defunkt/.vimrc
set foldmethod=syntax
set foldlevelstart=1
set foldnestmax=5
let javaScript_fold=1
set textwidth=0
"set foldclose=all
"colorscheme torte
" os x backspace fix
require "benchmark"
Benchmark.bm do |x|
5.times do
x.report do
o = Object.new
10000.times do
def o.method; end
end
end
end
@anildigital
anildigital / scaling.rb
Created December 20, 2008 05:03 — forked from lifo/scaling.rb
# Allow the metal piece to run in isolation
require(File.dirname(__FILE__) + "/../../config/environment") unless defined?(Rails)
class Scaling
def self.call(env)
if env["PATH_INFO"] =~ /^\/scaling/
[200, {"Content-Type" => "text/html"}, ["Hello, World!"]]
else
[404, {"Content-Type" => "text/html"}, ["Not Found"]]
end