Public Gists by jcapote

Gravatar
Sat Sep 05 14:26:28 -0700 2009
1
2
3
require 'benchmark'
 
str = "hey there whatever id like to remove e's and i's from this message"
Gravatar
Sat Sep 05 13:18:00 -0700 2009
1
2
3
require 'open-uri'
require 'benchmark'
 
Gravatar
Fri Sep 04 23:53:19 -0700 2009
1
2
require 'open-uri'
puts open('http://j.mp/3nqLRU').read.match(/<text>((\d|\.|\ )*)/)[0].gsub('<text>','').split(' ').map { |x| x.split('.').map { |y| ('A'..'Z').to_a[y.to_i - 1] } }
Gravatar
Sun Aug 09 23:36:55 -0700 2009

      
Gravatar
Mon Aug 03 10:06:59 -0700 2009
1
2
3
#cdr in ruby benchmarks
 
require 'benchmark'
Gravatar
Fri Jul 24 22:05:30 -0700 2009
1
2
3
capotej@P1:~ irb
irb(main):001:0> 1,3
SyntaxError: compile error
Gravatar
Mon Jul 20 15:59:52 -0700 2009
1
2
3
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'amatch'
Gravatar
Mon Jul 20 13:50:17 -0700 2009
1
2
3
require 'rubygems'
require 'amatch'
require 'digest/sha1'
Gravatar
Mon May 18 15:07:26 -0700 2009
1
2
3
  def model_for_table(table_name)
    table_name.classify.constantize
  end
Gravatar
Sat Mar 14 16:30:41 -0700 2009
1
2
3
#you can now chain operations by scope
 
Order.scoped_by_customer_id(12)
Gravatar
Tue Mar 10 17:56:16 -0700 2009
1
2
3
 create_table "addresses", :force => true do |t|
    t.string "firstname"
    t.string "lastname"
Gravatar
Sat Feb 28 14:18:11 -0800 2009
1
2
3
require 'feedzirra'
 
# fetching a single feed
Gravatar
Sat Feb 28 14:06:20 -0800 2009
1
2
3
require 'feedzirra'
 
# fetching a single feed
gist: 71424 using symbols as case condi...
Gravatar
Fri Feb 27 03:43:47 -0800 2009
1
2
3
def choose arg
   case arg
      when :something:
Gravatar
Sat Feb 21 03:47:50 -0800 2009
1
map.resources :photos, :requirements => { :id => /[A-Z][A-Z][0-9]+/ }
Gravatar
Sat Jan 24 00:03:05 -0800 2009
1
2
3
;; This buffer is for notes you don't want to save, and for Lisp evaluation.
;; If you want to create a file, visit that file with C-x C-f,
;; then enter the text in that file's own buffer.
Gravatar
Tue Dec 16 16:06:44 -0800 2008
1
2
3
(07:28:35 PM) capotej: whew, i switched to sequel from activerecord and my req/s skyrocketed
(07:30:30 PM) danishkirel [n=daniel@i59F5CFB6.versanet.de] entered the room.
(07:30:39 PM) MarkMenard_: capotej: What framework are you using for the web tier?
Gravatar
Tue Dec 09 11:30:29 -0800 2008
1
2
3
let's make a list of sinatra-based apps!
 
apps:
Gravatar
Mon Dec 08 19:52:40 -0800 2008
1
2
3
require 'rubygems'
require 'sinatra'
require 'json'
Gravatar
Wed Nov 26 17:54:24 -0800 2008
1
2
3
development:
  adapter: jdbc
  driver: org.apache.derby.jdbc.EmbeddedDriver