Skip to content

Instantly share code, notes, and snippets.

require 'rubygems'
require 'httparty'
module Upcoming
class Base
include HTTParty
format :xml
def self.api_key=(api_key)
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/atom10full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:gd="http://schemas.google.com/g/2005" gd:etag="W/&quot;CkIASHw9cSp7ImA9WxdaGEg.&quot;"><id>tag:blogger.com,1999:blog-6867964</id><updated>2008-08-27T11:22:29.269-04:00</updated><title>idiosyncranomicon</title><subtitle type="html" /><link rel="alternate" type="text/html" href="http://idiosyncranomicon.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/6867964/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://idiosyncranomicon.blogspot.com/feeds/posts/default" /><author><name>Kevin</name><ema
# module: audit2
class Audit < Thor
desc "all", "Run all audit tasks"
def all
%w(architecture database stats tests coverage flog roodi filesize queries).each do |task|
log "\n*** reviewing #{task}", true
log `thor audit:#{task}`, true
end
end
@reagent
reagent / photo.rb
Created January 11, 2009 02:31
A sample implementation of using Fleakr w/ ActiveRecord
class Photo < ActiveRecord::Base
belongs_to :user
def self.flickr_mapping
{
:flickr_id => :id,
:description => :description,
:title => :title,
:url => 'small.url'
@reagent
reagent / resume.markdown
Created January 18, 2009 15:09
Sample source / template for resume2 gem

<%= name %>

Objective

<%= objective %>

Work History

@reagent
reagent / content.rake
Created January 27, 2009 04:15
Convert old-style blurt content to new
namespace :content do
desc "Convert old-style code blocks to new format"
task :convert_code => :environment do
require 'hpricot'
Post.all.each do |post|
doc = Hpricot(post.body)
(doc/'code').each do |node|
header = node['lang'] ? " #lang:#{node['lang']}\n" : ''
class Response
def initialize(source_uri)
@source_uri = source_uri
@last_response = nil
end
def http_response_for(uri)
Net::HTTP.start(uri.host, uri.port) do |http|
@last_response = http.get(path_for(uri), 'User-Agent' => user_agent)
end
require 'rubygems'
require 'graft'
require 'time'
class AccountList
include Graft::Model
attribute :id
attribute :author, :from => 'author/name'
attribute :count, :from => 'openSearch:totalResults'
start_dir=`pwd`
for dir in `find . -type d | grep -v .svn | sort -r`; do
cd $dir
echo "cleaning $dir"
svn cleanup
cd $start_dir
done
ActionController::Routing::Routes.draw do |map|
map.resources :users, :only => [:show]
map.page 'page/*permalink', :controller => 'pages', :action => 'show'
end