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
>> rake db:migrate | |
WARNING: Global access to Rake DSL methods is deprecated. Please include | |
... Rake::DSL into classes and modules which use the Rake DSL methods. | |
WARNING: DSL method ResolutionTracker::Application#task called at /usr/lib/ruby/gems/1.8/gems/railties-3.0.7/lib/rails/application.rb:215:in `initialize_tasks' |
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
a = [] | |
bool = true | |
loop do | |
puts a.to_s | |
bool ? a.concat(['a']) : a.delete_at(0) | |
sleep 0.1 | |
if rand > 0.95 | |
bool ? bool = false : bool = true | |
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
[root@localhost rpm]# rpm -i RPMS/noarch/41_docs-0.noarch.rpm | |
package 41_docs-0.noarch.rpm is already installed | |
[root@localhost rpm]# rpm -e RPMS/noarch/41_docs-0.noarch.rpm | |
package RPMS/noarch/41_docs-0.noarch.rpm is not installed |
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
$ rake db:migrate --trace | |
(in /home/andrew/BioRails-Enterprise) | |
(in /home/andrew/BioRails-Enterprise) | |
(in /home/andrew/BioRails-Enterprise) | |
(in /home/andrew/BioRails-Enterprise) | |
(in /home/andrew/BioRails-Enterprise) | |
(in /home/andrew/BioRails-Enterprise) | |
(in /home/andrew/BioRails-Enterprise) | |
(in /home/andrew/BioRails-Enterprise) | |
(in /home/andrew/BioRails-Enterprise) |
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
named_scope :searchable, :conditions => ['parent_id is null'], :order => 'lower(name) ASC' | |
def self.magic | |
self.with_scope(:searchable) do | |
puts count | |
end | |
puts count | |
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
def scoped_model | |
if scope_name | |
self.model.send(scope_name) | |
else | |
self.model | |
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
def descendant_leaves | |
result = [] | |
result << children | |
until result.flatten!.all?{|x| x.leaf?} | |
result.each do |location| | |
unless location.leaf? | |
result << location.children | |
result.delete(location) | |
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
require 'rubygems' | |
require 'tweetstream' | |
TWITTER_USERNAME = 'XXXXX' | |
TWITTER_PASSWORD = 'XXXXX' | |
TweetStream::Client.new({:username => TWITTER_USERNAME, :password => TWITTER_PASSWORD}).sample do |status| | |
puts "[#{status.user.screen_name}] #{status.text}" | |
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
require 'rubygems' | |
require 'tweetstream' | |
TWITTER_USERNAME = 'XXXXXXX' | |
TWITTER_PASSWORD = 'XXXXXXXX' | |
ts = TweetStream.configure do |config| | |
config.username = 'XXXXXX' |
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 test_search_json | |
post :search, :option => 'all', :text => 'task', :format => :json | |
assert_response :success | |
json = JSON.parse(@respnose.body) | |
assert_equal 'task', json['text'] | |
assert_equal 1, json['hit_list'].count | |
end |