With rspec 1.x:
spec path/to/file_spec.rb:LINE_NUMBER
With rspec 2.x:
rspec path/to/file_spec.rb:LINE_NUMBER
rspec --tag TAG_NAME
BTW, tagging is accomplished like so:
request = require('request') | |
querystring = require('querystring') | |
module.exports = | |
help: [ | |
{ | |
command: '@agora image QUERY', | |
description: 'Fetches the first Google Image for QUERY' | |
} | |
] |
# So, I have an controller action that makes multiple calls to third-party APIs over http. | |
# I'd like to parallelize these calls via EventMachine::Synchrony::Multi, but can't figure out how to wire the controller | |
# | |
# This works fine from, say, a script on the command line, but not in a controller running on a thin server. | |
# | |
# What I was missing: a) rack/fiber_pool, b) we don't need the EM.synchrony block | |
class DemoController < ApplicationController # or a sinatra app, same result | |
# ... | |
def evented | |
multi = nil |
[ | |
{ "keys": ["super+backquote"], "command": "auto_complete" } | |
] |
With rspec 1.x:
spec path/to/file_spec.rb:LINE_NUMBER
With rspec 2.x:
rspec path/to/file_spec.rb:LINE_NUMBER
rspec --tag TAG_NAME
BTW, tagging is accomplished like so:
(function($) { | |
$.fn.selectText = function() { | |
var doc = window.document; | |
return this.each(function() { | |
var selection, range; | |
if (window.getSelection && doc.createRange) { | |
// modern FF, Safari, and Opera (I think) | |
selection = window.getSelection(); | |
range = doc.createRange(); | |
range.selectNodeContents(this); |
# A webserver version of le_twittre! | |
# usage: io twitter_frontend_server.io | |
# "API" : http://localhost:8080/?user=<username>, otherwise you get the public timeline. | |
# There's no native JSON tools, so I found this janky one. This is how you import files, basically. | |
# As a side-note, the autoloader is pretty cool. Check the Io Guide for more. | |
doFile("json.io") | |
server := HttpServer clone do( | |
setPort(8080) |
# bare Prototypes begin with a Capital Letter, and you usually clone Object: | |
Cube := Object clone | |
# := creates a new 'slot' on the receiver and sets that slot to the value of the right-hand side: | |
Cube sides := 6 | |
# Io has simple message-passing, no operator used: 'Receiver message' | |
Cube sides # ===> 6 | |
# to def a method rather than a raw property, use the "method" message: |
# Need to find out how many days are in the current month? | |
# leverage the power of Date#<<(n), which "rewinds" the date by n months. | |
# it helpfully sets the day correctly if you rewind from the 31st, so rewind from 12/31. | |
days_in_current_month = ( Date.new(Time.now.year, 12, 31).to_date << ( 12 - Time.now.month ) ).day | |
# You could also make this a method call | |
def days_in_month(month_number) | |
( Date.new(Time.now.year, 12, 31).to_date << ( 12 - month_number ) ).day |
>> c = Client.new(:name => "Rollmeback", :timezone => "UTC") | |
=> #<Client id: nil, name: "Rollmeback", ...> | |
>> Client.transaction do | |
?> c.save | |
>> raise ActiveRecord::Rollback | |
>> end | |
=> nil | |
>> c.id | |
=> 26 | |
>> Client.find(26) |
[chained_from_above].live("quickactions.close", function() { | |
$(this).removeClass("active"); | |
var disclosure = $(this).siblings(".quickactions_menu").first(); | |
disclosure.hide(); | |
}); | |
$("body").bind("click", function() { | |
// I'm sure there's a better jQuery way to specify a graph of nodes that should not trigger the close behavior, but | |
// I took the easy way out: | |
if($(this).is("body")) { | |
$(".menu_toggle").trigger("quickactions.close"); |