Skip to content

Instantly share code, notes, and snippets.

View flyerhzm's full-sized avatar
🏠
Working from home

Richard Huang flyerhzm

🏠
Working from home
View GitHub Profile
#!/usr/bin/env ruby
pid = `ps | grep script/serve[r] | awk '{ print $1 }'`.chomp
puts "Server PID: #{pid}"
url = ARGV.last
puts "URL: #{url}"
puts "Hit enter to go."
$stdin.gets
# To 2collegebums: This query generate a only one sql with left outer join,
# SELECT "comments"."id" AS t0_r0, "comments"."name" AS t0_r1, "comments"."post_id" AS t0_r2, "comments"."author_id" AS t0_r3, "base_users"."id" AS t1_r0, "base_users"."name" AS t1_r1, "base_users"."type" AS t1_r2, "posts"."id" AS t2_r0, "posts"."name" AS t2_r1, "posts"."category_id" AS t2_r2, "posts"."writer_id" AS t2_r3, "writers_posts"."id" AS t3_r0, "writers_posts"."name" AS t3_r1, "writers_posts"."type" AS t3_r2 FROM "comments" LEFT OUTER JOIN "base_users" ON "base_users".id = "comments".author_id LEFT OUTER JOIN "posts" ON "posts".id = "comments".post_id LEFT OUTER JOIN "base_users" writers_posts ON "writers_posts".id = "posts".writer_id AND ("writers_posts"."type" = 'Writer' ) WHERE (base_users.id = 1)
# so I think the test is not correct.
#
# this happens because it doesn't create an object association from post to writer
# by diving into the hash and creating those object associations
it "should detect preload of post => wr
>> variable = ['key', 'value']
>> key, value = *variable
>> key
=> "key"
>> value
=> "value"
/opt/local/bin/ruby -I"lib:test" "/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/integration/agent_test.rb" "test/integration/book_test.rb" "test/integration/bookshelf_test.rb" "test/integration/chapter_test.rb" "test/integration/helpers/left_nav_test.rb" "test/integration/helpers/local_app_controlls_test.rb" "test/integration/model_test.rb" "test/integration/page_test.rb" "test/integration/rule_test.rb" "test/integration/sessions_test.rb" "test/integration/url_mapper_test.rb" "test/integration/user_test.rb"
Loaded suite /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
FF..FF............E.
Finished in 38.243175 seconds.
1) Failure:
test: The public an agent should create_agent_when_logged_in. (AgentTest)
[/test/integration/agent_test.rb:39:in `__bind_1256130558_905613'
vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/context.rb:253:in `call'
puts <<ASCII
/´¯/)
,/¯ /
/ /
/´¯/' '/´¯¯`·¸
/'/ / / /¨¯\\
('( ´ ´ ¯~/' ')
\\ ' /
'' \\ _ ·´
\\ (
if(!UserVoice){var UserVoice={};}
UserVoice.Util={
sslAssetHost:"https://cdn.uservoice.com",
assetHost:"http://cdn.uservoice.com",
getAssetHost:function(){
return("https:"==document.location.protocol)?this.sslAssetHost:this.assetHost;
},
render:function(template,params){
return template.replace(/\#{([^{}]*)}/g,function(a,b){
var r=params[b];return typeof r==='string'||typeof r==='number'?r:a;
class User < ActiveRecord::Base
has_attached_file :avatar, :styles => {:thumb => '100x100>'}
end
###########
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.string :avatar_file_name
--- ruby18-growl.rb 2005-11-14 21:15:15.000000000 -0800
+++ ruby-growl.rb 2009-11-22 00:47:06.000000000 -0800
@@ -2,7 +2,7 @@
$TESTING = false unless defined? $TESTING
-require 'md5'
+require 'digest/md5'
require 'socket'
b64 = Base64.b64encode(File::read(cert_file), 64)
pem = "-----BEGIN CERTIFICATE-----\n#{b64}-----END CERTIFICATE-----\n"
cert = OpenSSL::X509::Certificate.new(pem)
public_key = cert.public_key
git clone git://github.com/ezmobius/redis-rb.git
cd redis-rb/
rake redis:install
rake dtach:install
rake redis:start &
rake install