Skip to content

Instantly share code, notes, and snippets.

View francois's full-sized avatar

François Beausoleil francois

  • Sherbrooke, QC, Canada
View GitHub Profile
The gem build system failed with the following error:
Could not find gemspec at rspactor.gemspec in [".gitignore", "README.rdoc", "Rakefile", "VERSION", "bin", "lib", "rest-client.gemspec", "spec"]
$ irb -rubygems
>> require "tzinfo"
=> true
>> mtl = TZInfo::Timezone.get("America/Montreal")
=> #<TZInfo::DataTimezone: America/Montreal>
>> utc = TZInfo::Timezone.get("Etc/UTC")
=> #<TZInfo::DataTimezone: Etc/UTC>
>> midnight_utc = utc.local_to_utc(Time.parse("2009-08-22 00:00"))
=> Sat Aug 22 00:00:00 UTC 2009
>> mtl.utc_to_local(midnight_utc)
require "test/unit/assertions"
include Test::Unit::Assertions
# JRuby code to have a lot less to type later
require "java"
require "lucene-core.jar"
import "org.apache.lucene.analysis.standard.StandardAnalyzer"
import "org.apache.lucene.store.RAMDirectory"
import "org.apache.lucene.index.IndexWriter"
import "org.apache.lucene.document.Document"
Report your Ruby version on your prompt
#!/usr/bin/sh
# Put this in your ~/.bash_profile, ~/.bashrc or wherever
# Copied and adapted from http://code.google.com/p/git-osx-installer/
export PS1='\[\033[01m\]\w$(git branch &>/dev/null; if [ $? -eq 0 ]; then echo " (\[\033[22m\]$(git branch | grep ^*|sed s/\*\ //)\[\033[01m\])"; fi) [`ruby -v | awk "{print \\\\$2}"`]\$\[\033[00m\] '
~/Projects [1.8.6]$ source ruby19
~/Projects [1.9.1p0]$ cat ~/.bash_profile
# This is a watchr script: http://github.com/mynyml/watchr
RAILS_ENV = "test"
$LOAD_PATH.unshift "test"
puts "Requiring test/test_helper"
require "test_helper"
puts "Done: waiting for events"
watch 'test/.*_test\.rb' do |md|
require "hobo_fields"
class PhoneNumber < DelegateClass(String)
COLUMN_TYPE = :string
HoboFields.register_type(:phone_number, self)
def validate
"should match the general pattern xxx-xxx-xxxx" unless blank? || valid?
require "rubygems"
require "mq"
# Here, we block until we receive a message. Since tmm1's amqp gem is callback based,
# the blocks are invoked when an action is required of user code.
EM.run do
# Each queue represents an end-point: a place where messages are distributed.
# If multiple processes/clients use the *same queue name*, the server will
# round-robin messages to each process/client.
queue = MQ.queue("integers channel")
$ irb
irb(main):001:0> "abc".gsub(/\D/)
=> #<Enumerable::Enumerator:0x1018e0588>
irb(main):002:0> "abc".gsub(/\D/).to_s
=> "#<Enumerable::Enumerator:0x1018dbdd0>"
irb(main):003:0> RUBY_VERSION
=> "1.8.7"
source :gemcutter
gem "rails", "= 2.3.4"
gem "pg", "~> 0.8.0" if !defined?(JRUBY_VERSION)
gem "will_paginate", ">= 2.3.11"
gem "rubyist-aasm", ">= 2.1.1"
gem "sparklines", ">= 0.5.2"
gem "treetop", ">= 1.4.2"
gem "escape", ">= 0.0.4"