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
~/sources/dm-core(master) | |
domU-12-31-39-02-F4-E8 $ rake package | |
(in /root/sources/dm-core) | |
rake aborted! | |
no such file to load -- spec/rake/spectask | |
/root/sources/dm-core/Rakefile:6 | |
(See full trace by running task with --trace) | |
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
=begin | |
Upgraded to rails 2.3.4 and got the following error: | |
undefined method self_and_descendants_from_active_record for Class:Object | |
My class doesn't descend from ActiveRecord but I was using ActiveRecord::Errors for validations | |
attr_accessor :errors | |
def initialize | |
#this hack is to get an instance of ActiveRecord::Errors: |
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
Loading development environment (Rails 2.3.4) | |
>> r = Rule.first | |
=> #<Rule @id=1 @name="Send Call" @description=<not loaded> @last_run_at=Wed, 11 Feb 2009 10:37:58 -0800 @is_auto_approved=false @send_only_unique=false> | |
>> require 'pp' | |
=> ["PP"] | |
>> pp r["description"] | |
"Awesome customers get good stuff." | |
=> nil |
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
>> ActionRequest.all(:approved_at=>nil, :cancelled_at=>nil).aggregate(:rule_id, :all.count, :created_at.max) | |
ArgumentError: +options[:fields]+ entry nil of an unsupported object NilClass | |
from /Library/Ruby/Gems/1.8/gems/dm-core-0.10.1/lib/dm-core/query.rb:693:in `assert_valid_fields_without_operator' | |
from /Library/Ruby/Gems/1.8/gems/dm-core-0.10.1/lib/dm-core/query.rb:680:in `each' | |
from /Library/Ruby/Gems/1.8/gems/dm-core-0.10.1/lib/dm-core/query.rb:680:in `assert_valid_fields_without_operator' | |
from /Library/Ruby/Gems/1.8/gems/dm-aggregates-0.10.1/lib/dm-aggregates/query.rb:23:in `assert_valid_fields' | |
from /Library/Ruby/Gems/1.8/gems/dm-core-0.10.1/lib/dm-core/query.rb:656:in `assert_valid_options' | |
from /Library/Ruby/Gems/1.8/gems/dm-core-0.10.1/lib/dm-core/query.rb:654:in `each' | |
from /Library/Ruby/Gems/1.8/gems/dm-core-0.10.1/lib/dm-core/query.rb:654:in `assert_valid_options' | |
from /Library/Ruby/Gems/1.8/gems/dm-core-0.10.1/lib/dm-core/query.rb:598:in `initialize' |
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
$ gem list | grep mongo | |
mongo (0.16) | |
$ irb | |
>> require 'mongo' | |
=> true | |
>> include Mongo | |
=> Object | |
>> db = Connection.new('localhost').db('testingmg') | |
=> #<Mongo::DB:0x1017ebfb0 @host="localhost", @name="testingmg", @pk_factory=nil, @socket=#<TCPSocket:0x1017ebd08>, @slave_ok=nil, @strict=nil, @semaphore=#<Mutex:0x1017ebe48>, @nodes=[["localhost", 27017]], @auto_reconnect=nil, @port=27017, @logger=nil> | |
>> coll = db.collection('Person') |
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
/* | |
Requirements: | |
1. A table of zip codes that contain latitude and longitude columns. | |
Mine is called zip_codes and has the following relative columns: | |
city, state, zip, latitude, longitude | |
These datasets are available for sale online. | |
This data seems to be free from http://geocoder.ibegin.com/downloads.php |
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
# Building on the zips_near_zip procedure in this gist: http://gist.github.com/319908 | |
# I added a named scope to my model which has an attribute of "service_address_id": | |
# call to sanitize_sql_array to avoid sql injection. | |
named_scope :near_zip, lambda { |zip, miles| | |
{ :joins=>sanitize_sql_array(["join addresses | |
on service_address_id=addresses.id | |
join zips_near_zip(?,?) | |
on zip_code = zip",zip, miles]) } |
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 'twitter' | |
require "highline/import" | |
username = ask("Username: ") | |
password = ask("Enter your password: ") { |q| q.echo = '*' } | |
httpauth = Twitter::HTTPAuth.new(username, password) | |
client = Twitter::Base.new(httpauth) | |
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 s;"def s;;end;puts s()[0,6]+34.chr+s+34.chr+s()[6,s.length-6]";end;puts s()[0,6]+34.chr+s+34.chr+s()[6,s.length-6] |
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
to reconnect to screen session: | |
screen -r | |
to exit screen session: | |
Ctrl+a, d | |
to kill screen session: | |
Ctrl+a, k |
OlderNewer