Innovation in Ruby

August 8th, 2008 admin

Just got done doing a presentation with Gregg Pollack at the Ruby Hoedown. The talk was on Innovation in Ruby in the last year. You can grab a cheat sheet over on the Rails Envy web site.

Posted in ruby | No Comments »

Backpack Ruby Script

July 22nd, 2008 admin

Each week I edit the Rails Envy podcast. We use Backpack to work together on the stories each week. Each story is a note in the Backpack page:

Today while I was preparing the post, I remembered that Backpack had an API. A quick google turned up the Backpack API page with a link to the Ruby wrapper. About 10 minutes and some regular expressions later I had a script to auto format the weekly podcast links each week by just passing in the page id.

require 'rubygems'
require 'XmlSimple'
require 'ruby_wrapper'
 
stories = []
backpack = Backpack.new('username', 'api key');
backpack.page_id='the page you want'
notes = backpack.list_notes
notes = notes['notes'].first['note']
 
# {'title' => 'A note', 'id' => 'An id', 'content' => 'asdf followed by a url'}
notes.each do |note|
  story_link = note['content'].scan(/(http\:\/\/.*)$/m)[0]
  stories.push("<li><a title=\"#{note['title']}\" href=\"#{story_link}\" rel=\"nofollow\">#{note['title']}</a></li>".gsub(/\n/,''))
end
 
puts stories.join("\n")

Posted in ruby | 1 Comment »

I’m Batman

July 18th, 2008 admin

Ok, I normally wouldn’t do this but this was so funny I had to post it. If you know where this came from please leave a comment.

I\'m Batman animated gif

I'm Batman

Posted in Uncategorized | No Comments »

Hpricot and utf-8

March 18th, 2008 admin

I tried to use Hpricot to parse a page with special characters in a utf-8 encoding. The docs tell you to do this:

require 'rubygems'
require 'open-uri'
require 'hpricot'
 
doc = Hpricot(open("http://url/"))

However, this won’t give you the output you want. The open method on Open-URI leaves the output in the default character set of the page. If you want to convert it to utf-8, you need to use the iconv library:

require 'rubygems'
require 'iconv'
require 'open-uri'
require 'hpricot'
 
f = open("http://url")
f.rewind
doc = Hpricot(Iconv.conv('utf-8', f.charset, f.readlines.join("\n")))

Posted in ruby | 3 Comments »

Unobtrusive Javascript

March 13th, 2008 admin

In January, I gave a presentation at the Orlando Ruby Users Group about unobtrusive javascript. I figured that I’d reproduce it here for anyone who wanted to watch it. Some topics covered in the video include semantic markup, benefits of coding unobtrusively, examples, and guidelines. Special thanks to Gregg Pollack for editing the video, and an extra special thanks to Jason Hawkins from Make Film Work for filming.


Unobtrusive Javascript Presentation from Jason Seifer on Vimeo.

Posted in Javascript | 1 Comment »

The Best Salt Shakers In The World

March 3rd, 2008 admin

Tragedy Strikes

It was a true tragedy I didn’t win this.

 

Posted in Misc | No Comments »