This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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}` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on run argv | |
tell application "Preview" | |
activate | |
open (item 1 of argv) | |
tell application "System Events" | |
tell process "Preview" | |
set frontmost to true | |
keystroke "g" using {command down, option down} | |
keystroke (item 2 of argv) | |
key code 36 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
email AS accountid, | |
first_design_saved_at AS dt_save, | |
'beta' AS timeline, | |
'G' AS content_type | |
FROM | |
accounts | |
WHERE | |
first_design_saved_at > DATE '2009-05-29' | |
AND rownum < 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grammar J | |
rule verbs | |
integers | |
end | |
rule integers | |
'i.' number { | |
def value | |
(0...number.value).map {|x| x} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Array | |
alias_method :old_times, :* | |
def *(multiplier) | |
if multiplier.class != Array | |
self.old_times multiplier | |
else | |
if self.size != multiplier.size | |
raise "length error" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "net/http" | |
require "open-uri" | |
data = open("http://cdo.ncdc.noaa.gov/climatenormals/clim84/IL/IL110055.txt").map | |
#data = open("http://cdo.ncdc.noaa.gov/climatenormals/clim84/IL/IL112679.txt").map | |
metric = {} | |
metric[:station_coop_id] = data[4][44..49] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- @tags.each do |tag| | |
= link_to tag.name, tag_path(tag) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
controller: | |
def show | |
begin | |
asset = Attachment.find(params[:id]).asset | |
render :text => "#{asset.path} #{asset.content_type} #{asset.original_filename}" | |
rescue | |
session_redirect | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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' |
OlderNewer