Public Gists by ocean

Gravatar
Sun Nov 01 17:56:38 -0800 2009
1
2
3
<!DOCTYPE html>
<html>
  <head>
Gravatar
Thu Oct 15 03:54:02 -0700 2009
1
2
3
<h1>Feeds Checker</h1>
 
<%
Gravatar
Fri Jun 19 08:46:20 -0700 2009
1
2
3
#!/usr/bin/ruby
 
require 'rubygems'
Gravatar
Tue Jun 16 02:09:30 -0700 2009
1
2
3
The below Sinatra code works with URLs like:
 
/c/blahblah
Gravatar
Wed Jun 10 02:07:07 -0700 2009
1
2
3
def html_entity_escape(string)
  fixed = string.to_s.gsub(/&/, "&amp;").gsub(/½/, "&#189;").gsub(/¼/, "&#188;").gsub(/¾/, "&#190;").gsub(/“/, "&#8220;").gsub(/”/, "&#8221;").gsub(/’/, "&#8217;").gsub(/‘/, "&#8216;")
  #fixed = string.to_s.gsub(/38/, "&amp;").gsub(/189/, "&#189;").gsub(/188/, "&#188;").gsub(/190/, "&#190;").gsub(/8220/, "&#8220;").gsub(/8221/, "&#8221;").gsub(/8217/, "&#8217;").gsub(/8216/, "&#8216;")
Gravatar
Wed May 27 02:27:02 -0700 2009
1
2
3
  #results.each do |row|
  results.each_hash do |row|
    # 'collect' enables handling of NULL/nil values
Gravatar
Wed May 20 22:45:15 -0700 2009
1
2
3
I got the idea, and most of this code, from this post at The Killswitch Collective:
 
http://www.killswitchcollective.com/articles/45_legacy_data_migration_with_activerecord
Gravatar
Wed Nov 19 21:54:34 -0800 2008
1
p "Oh I see, a Gist is a bit like a Pastie."