Skip to content

Instantly share code, notes, and snippets.

View seanstickle's full-sized avatar

Seán Stickle seanstickle

View GitHub Profile
# Trace is a model in vendor/plugins/mylogger/lib/app/models/trace.rb
# vendor/plugins/mylogger/lib/mylogger.rb
#...
module MyLoggerImpl
def self.trace(controller_instance)
puts 'Tracing'
controller:
def show
begin
asset = Attachment.find(params[:id]).asset
render :text => "#{asset.path} #{asset.content_type} #{asset.original_filename}"
rescue
session_redirect
end
def create
@ticket = Ticket.new(params[:ticket])
flash[:notice] = "Ticket created."
redirect_to(@ticket)
end
def validate
errors.add("No such category") unless self.category
end
#!/usr/bin/env ruby
require "rubygems"
require "hpricot"
require "open-uri"
url = "http://feeds.feedburner.com/Rubyconf2008-Confreaks"
(Hpricot(open url)/:enclosure).map {|x| x.attributes["url"]}.uniq.each do |vid|
File.exist?(vid.split("/").last) ? next : `wget #{vid}`