Skip to content

Instantly share code, notes, and snippets.

View jarinudom's full-sized avatar

Jarin Udom jarinudom

View GitHub Profile
@jarinudom
jarinudom / bitcoin.rb
Created June 9, 2011 09:33
Simple bitcoin plugin for campfire-bot
class Bitcoin < CampfireBot::Plugin
on_command 'bitcoin', :bitcoin
# on_message registered below...
def initialize()
@log = Logging.logger["CampfireBot::Plugin::Bitcoin"]
end
def bitcoin(msg)
url = "https://mtgox.com/code/data/ticker.php"
(in /data/DevOpsGame/releases/20110517014854)
** Invoke environment (first_time)
** Execute environment
** Invoke resque:work (first_time)
** Invoke resque:setup (first_time)
** Execute resque:setup
** Execute resque:work
rake aborted!
undefined method `get' for nil:NilClass
/data/DevOpsGame/shared/bundled_gems/ruby/1.9.1/gems/redis-namespace-1.0.2/lib/redis/namespace.rb:213:in `method_missing'
desc "remotely console"
task :console, :roles => :app do
input = ''
run "cd #{current_path} && rails console #{ENV['RAILS_ENV']}" do |channel, stream, data|
next if data.chomp == input.chomp || data.chomp == ''
print data
channel.send_data(input = $stdin.gets) if data =~ /:\d{3}:\d+(\*|>)/
end
end
desc "remotely console"
task :console, :roles => :app do
input = ''
run "cd #{current_path} && ./script/console #{ENV['RAILS_ENV']}" do |channel, stream, data|
next if data.chomp == input.chomp || data.chomp == ''
print data
channel.send_data(input = $stdin.gets) if data =~ /^(>|\?)>/
end
end
@jarinudom
jarinudom / config.ru
Created December 30, 2010 08:43
The ULTIMATE SECRET to getting Compass to work on Heroku with a Rails 3 app
# Put this in config.ru, BEFORE "run MyApp::Application"
use Rack::Static, :urls => ['/stylesheets'], :root => 'tmp'
# /app/helpers/application_helper.rb
module ApplicationHelper
def priority_human(value)
case value
when 1
'High'
when 2
'Medium'
when 3
'Low'
# lib/priority_mapper.rb
module PriorityMapper
extend ActiveSupport::Concern
module InstanceMethods
def priority_human
case priority
when 1
'High'
when 2
<profile>
<site_url>http://www.setformarriage.com</site_url>
<url>http://www.setformarriage.com/users/1</url>
<user_name>Brad</user_name>
<dob>1979-10-12</dob>
<gender>male</gender>
<seeking>female</seeking>
<zip>77054</zip>
<photo>http://www.setformarriage.com/system/photos/1/dsh/DSC06644.JPG?1281329860</photo>
<description>I am a successful entrepreneur who has a passion for business. Running this website and making it as successful as possible along with helping as many people as I can keeps my fire burning. </description>
******************************************************
* TICKET #2402-811 *CLOSED* 2010-02-24 *
******************************************************
* *
* ASSIGNED : n/a *
* DEPT CODE : AAV *
* CUSTOMER : 84125, James A------ *
* WORKSTAION: BCDM-643843 *
* SITE : M/BCD *
* *
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=720, user-scalable=yes"/>
<meta name="description" content="{MetaDescription}"/>
<title>{Title}{block:PostSummary} - {PostSummary}{/block:PostSummary}</title>
<!-- DEFAULT COLORS -->