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 show | |
@xyz = Xyz.find( params[:id] ) | |
if @xyz | |
# render page | |
else | |
# render error template or redirect to error page | |
end | |
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
[http://feeds.feedburner.com/Flickrblog] | |
name = Flickr Blog | |
face = flickr.gif | |
facewidth = 106 | |
faceheight = 35 | |
[http://blog.360.yahoo.com/rss-1qCkw2Ehaak.hdNZkEAzDrpa4Q--?cq=1] | |
name = Y! 360 US Blog | |
face = y_360.gif | |
facewidth = 195 |
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 SomeModel < ActiveRecord::Base | |
serialize :data | |
xss_terminate :except => [:data] | |
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
class CreateRelationships < ActiveRecord::Migration | |
def self.up | |
create_table :relationships do |t| | |
t.integer :user_id | |
t.integer :following_id | |
t.timestamps | |
end | |
add_index( :relationships, [ :user_id, :following_id ], :unique => true ) |
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 UserSession < Authlogic::Session::Base | |
last_request_at_threshold 43200 | |
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
class UserSessionsController < ApplicationController | |
# ... | |
def rpx_token | |
data = RPXNow.user_data( params[:token], RPX_API_KEY ) | |
if data.blank? | |
flash[:error] = I18n.t("auth.failed") | |
redirect_to(new_user_session_path) |
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
-- http://bbs.applescript.net/viewtopic.php?id=22890 | |
on formatDate(theFormat, theDate) | |
-- Example for `theDate`: "2007-10-23T17:54:23" | |
try | |
do shell script "/usr/local/bin/ruby -e 'require \"parsedate\"; puts Time.local(*ParseDate.parsedate(ARGV[1])).strftime(ARGV[0])' " & ¬ | |
quoted form of theFormat & " " & quoted form of theDate | |
on error | |
-- The date could not be parsed | |
return false | |
end try |
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
namespace :worker do | |
desc "Start Twitter worker." | |
task :start_v1 do | |
run "cd #{current_path} && rake worker:start" # funktioniert nicht | |
end | |
desc "Start Twitter worker." | |
task :start_v2 do | |
run "cd #{current_path} && ./script/runner ./jobs/twitter_fetcher.rb &" # funktioniert nicht | |
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
#!/usr/local/bin/ruby | |
require "rubygems" | |
require "haml" | |
puts Haml::Engine.new( STDIN.read.gsub( /\t/, " " ), { :escape_html => true } ).render |
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/local/bin/ruby | |
require "hpricot" | |
require "net/http" | |
require "uri" | |
TUMBLR_USER = "user@example.com" | |
TUMBLR_PASS = "thepasswordlol" | |
TUMBLR_DOMAIN = "mytumblrsubdomain.tumblr.com" | |
ORIGINAL_DOMAIN = "http://myoriginaldomain.example.com/" |