Skip to content

Instantly share code, notes, and snippets.

View kusor's full-sized avatar
💭
Positively happy

Pedro Palazón Candel kusor

💭
Positively happy
  • Joyent Inc.
  • Murcia (Spain)
  • X @kusor
View GitHub Profile
>> require 'rubygems'
=> true
>> require 'patron'
=> true
>> require 'json'
=> true
>> s = Patron::Session.new
=> #<Patron::Session:0x187a978>
>> s.base_url = 'http://twitter.com'
=> "http://twitter.com"
@kusor
kusor / fater_builder_nokogiri.rb
Created November 22, 2009 15:01
Compare FasterBuilder and Nokogiri::Builder
$LOAD_PATH.unshift File.dirname(__FILE__)
require 'rubygems'
require 'nokogiri'
require 'faster_builder/xml_markup'
require 'benchmark'
def nokogiri_builder
b = Nokogiri::XML::Builder.new do |xml|
xml.task do
commit 7fba8f5e4978b2ff990304f7150918f1cc0eea74
Author: Aman Gupta <[email protected]>
Date: Fri Mar 27 13:51:30 2009 -0700
dtrace patch for 1.8.7 (run autoconf, then ./configure --disable-pthread --enable-dtrace --prefix=/opt/ruby-dtrace)
diff --git a/Makefile.in b/Makefile.in
index a37bcf6..604bfed 100644
--- a/Makefile.in
+++ b/Makefile.in
@kusor
kusor / gist:229816
Created November 9, 2009 09:07 — forked from tmm1/gist:89588
require 'rubygems'
require 'eventmachine'
module ChatClient
def self.list
@list ||= []
end
def post_init
@name = "anonymous_#{rand(99999)}"
# :PUBLISHER: markdown, shell, { command: 'rdiscount' }
# :BRACKET_CODE: '[ruby]', '[/ruby]'
# :TEXT:
#
# Have you ever started a long operation and walked away from the computer, and
# come back half an hour later only to find that the process is hung up waiting
# for some user input? It's a sub-optimal user experience, and in many cases it
# can be avoided by having the program choose a default if the user doesn't
# respond within a certain amount of time. One example of this UI technique in
# the wild is powering off your computer - most modern operating systems will
git branch --no-color | grep \* | awk '{print $2}'
@kusor
kusor / .irbrc
Created September 30, 2009 17:13
$KCODE='u'
require 'jcode'
require 'irb/completion'
require 'irb/ext/save-history'
IRB.conf[:SAVE_HISTORY] = 100
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history"
IRB.conf[:PROMPT_MODE] = :SIMPLE
$ irb
>> require 'rubygems'
=> true
>> require 'patron'
=> true
>> require 'json'
=> true
>> sess = Patron::Session.new
=> #<Patron::Session:0x682cd4>
>> sess.timeout = 30
begin
require 'minigems'
rescue LoadError
require 'rubygems'
end
if File.directory?(gems_dir = File.join(Dir.pwd, 'gems')) ||
File.directory?(gems_dir = File.join(File.dirname(__FILE__), '..', 'gems'))
$BUNDLE = true; Gem.clear_paths; Gem.path.unshift(gems_dir)
end
begin
require 'minigems'
rescue LoadError
require 'rubygems'
end
if File.directory?(gems_dir = File.join(Dir.pwd, 'gems')) ||
File.directory?(gems_dir = File.join(File.dirname(__FILE__), '..', 'gems'))
$BUNDLE = true; Gem.clear_paths; Gem.path.unshift(gems_dir)
end