My Recent Pastes (21 and counting)
All Pasties (over 21 and counting)
Pages: 1 2
Below are summaries of the 15 most recent pasties by winson.
November 12, 2007
5:19AM EDT
by winson
View more (7 lines)
1 2 3 4 5 |
def auto_bizman(text)
if match = text.match(/.*?(@)((?:[_a-zA-Z0-9]+))(:|\s)/i)
user = match[2]
text.gsub! user, "<a href='#{app_url}#{user}'>#{user}</a>"
end
|
November 12, 2007
5:18AM EDT
by winson
View more (8 lines)
1 2 3 4 5 |
def auto_bizman(text)
if match = text.match(/.*?(@)((?:[_a-zA-Z0-9]+))(:|\s)/i)
user = match[2]
# text.gsub!(user, '<a href="http://twitter.com/' + user + '">' + user + '</a>')
text.gsub! user, "<a href='#{app_url}#{user}'>#{user}</a>"
|
November 10, 2007
3:11AM EDT
by winson
View more (19 lines)
1 2 3 4 5 |
# Send a public message.
def post
@message = Message.new params[:message]
@message.user = current_user
# FIXME: Move empty check to browser side.
|
November 10, 2007
3:10AM EDT
by winson
View more (19 lines)
1 2 3 4 5 |
# Auto shorten url with shorturl gem. # FIXME: There're 2 bugs in ShortURL by Vincent Foley. # [#8376] tinyurls redirect to URLs with encoded chars, causing 404. # http://rubyforge.org/tracker/index.php?func=detail&aid=8376&group_id=732&atid=2893 |
November 10, 2007
3:10AM EDT
by winson
View more (23 lines)
1 2 3 4 5 |
# General error catcher.
def rescue_action_in_public(exception)
case exception
when NoMethodError
error_stickie "Please donate us!!"
|
November 10, 2007
2:18AM EDT
by winson
View more (10 lines)
1 2 3 4 5 |
# Customize finder.
def self.find(*args)
# Recent 20 messages, using Message.find :recent.
if args.first.to_s == 'recent'
|
June 19, 2007
1:52AM EDT
by winson
View more (97 lines)
1 2 3 4 5 |
#!/usr/bin/env ruby # # Control script for Mongrel by Winson. SCRIPT_VERSION = '0.6' |
June 18, 2007
11:13PM EDT
by winson
View more (97 lines)
1 2 3 4 5 |
#!/usr/bin/env ruby # # Control script for Mongrel by Winson. SCRIPT_VERSION = '0.6' |
June 18, 2007
2:01PM EDT
by winson
View more (88 lines)
1 2 3 4 5 |
#!/usr/bin/env ruby # # Control script for Mongrel by Winson. SCRIPT_VERSION = '0.6' |
May 17, 2007
7:21AM EDT
by winson
View more (43 lines)
1 2 3 4 5 |
require File.dirname(__FILE__) + '/../test_helper' require 'user_controller' # Re-raise errors caught by the controller. class UserController; def rescue_action(e) raise e end; end |
May 17, 2007
7:20AM EDT
by winson
View more (14 lines)
1 2 3 4 5 |
require File.dirname(__FILE__) + '/../test_helper' class UserTest < Test::Unit::TestCase fixtures :users |
May 12, 2007
12:48PM EDT
by winson
View more (13 lines)
1 2 3 4 5 |
def new @page_title = 'Hello' return unless request.post? @user = User.new(params[:user]) @user.password = params[:user][:password] |
May 11, 2007
3:07AM EDT
by winson
1 2 3 4 |
def self.random
# find(rand(count)) rescue ActiveRecord::RecordNotFound random
find(:all)[rand(count)]
end
|
May 11, 2007
2:53AM EDT
by winson
1 2 3 |
def self.random
find(rand(count) + 1) rescue ActiveRecord::RecordNotFound random
end
|
May 09, 2007
6:28AM EDT
by winson
View more (35 lines)
1 2 3 4 5 |
class ApplicationController < ActionController::Base before_filter :get_uri, :except => [:login, :new] helper_method :current_user private |
Pastie