I hereby claim:
- I am sixty4bit on github.
- I am sixty4bit (https://keybase.io/sixty4bit) on keybase.
- I have a public key whose fingerprint is FF61 67DD BE84 A843 36F0 558C 04F8 F0CE DF1F 9DEB
To claim this, I am signing this object:
@stream = Twitter::Streaming::Client.new do |config| | |
config.consumer_key = ENV['TWITTER_CONSUMER_KEY'] | |
config.consumer_secret = ENV['TWITTER_CONSUMER_SECRET'] | |
config.access_token = ENV['TWITTER_ACCESS_TOKEN'] | |
config.access_token_secret = ENV['TWITTER_ACCESS_TOKEN_SECRET'] | |
end | |
keywords = ['sochi', 'olympics'] | |
@stream.filter(:track => keywords.join(",")) do |object| | |
if object.is_a?(Twitter::Tweet) | |
puts "#{object.id} #{object.user.screen_name} - #{object.text}" |
I hereby claim:
To claim this, I am signing this object:
{ active: 'activate!', inactive: 'deactivate!', blocked: 'block!', suggested: 'suggest!' }.each do |state_name, trigger_name| | |
define_singleton_method(state_name) { where(state: state_name.to_s) } | |
define_method(trigger_name.to_sym) { update_attribute(state: state_name.to_s) } | |
end | |
>> Project.reflections.each {|a| puts a.class } | |
Array | |
=> {:tasks=>#<ActiveRecord::Reflection::AssociationReflection:0x222cbc4 @klass=Task(id: integer, name: string, project_id: integer, created_at: datetime, updated_at: datetime), @primary_key_name="project_id", @through_reflection=false, @macro=:has_many, @options={:extend=>[]}, @name=:tasks, @quoted_table_name="\"tasks\"", @class_name="Task", @active_record=Project(id: integer, name: string, created_at: datetime, updated_at: datetime)>} | |
>> | |
class InquireyResponseHandler < ActionMailer::Base | |
def receive(email) | |
user = User.find_by_email(email.from[0]) | |
Mood.create :message => email.body, :user => user | |
end | |
end |
App failed to start | |
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack.rb:17: warning: already initialized constant VERSION | |
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/plugin/loader.rb:184:in `ensure_all_registered_plugins_are_loaded!': Could not locate the following plugins: community_engine and white_list (LoadError) | |
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/plugin/loader.rb:44:in `load_plugins' | |
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:348:in `load_plugins' | |
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:163:in `process' | |
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:113:in `send' | |
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:113:in `run' | |
from /disk1/home/slugs/12838_f2b2289_c549/mnt/config/environment.rb:11 |
<script type="text/javascript"> | |
function comma(num) { | |
var collector = new Array(); | |
var numberArray = ('' + num).split('').reverse(); | |
for(var i = 0; i < numberArray.length; i++) { | |
if(i % 3 == 0 && i != 0) collector.push(","); | |
collector.push(numberArray[i]); | |
} | |
return collector.reverse().join(''); | |
} |
class Numeric | |
# Usage: 1234.commify # => '1,234' | |
def commify | |
self.to_s.reverse.scan(/(?:\d*\.)?\d{1,3}-?/).join(',').reverse | |
end | |
end |
class Object | |
# call send on nested objects. | |
# example: nested_send(blog_post, 'author.name') #=> 'Bob' | |
# returns nil if any call returns nil | |
def nested_send(method_name) | |
val = self | |
method_names = method_name.split('.') | |
method_names.each do |m| | |
return nil unless val |
// Make all lines comments first | |
BufferedReader inputFile = new BufferedReader(new FileReader("input.txt")); | |
String line = null; | |
while((line=inputFile.readLine())!=null){ | |
System.out.println("comment found: " + line); | |
} | |
// Now find email addresses | |
BufferedReader inputFile = new BufferedReader(new FileReader("input.txt")); | |
String line = null; |