I hereby claim:
- I am barmstrong on github.
- I am barmstrong (https://keybase.io/barmstrong) on keybase.
- I have a public key whose fingerprint is 04E5 646B 0985 2F02 DBA9 D1B0 F644 1CB3 7764 6F68
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
module Celluloid | |
class Thread < ::Thread | |
def []= key, value | |
if key_on_thread? key | |
thread_vars[key] = value | |
else | |
super | |
end | |
end |
def self.days_of_week time_ago | |
days = Hash.new(0) | |
Transaction.find_each(:conditions => ["created_at > ?", time_ago]) do |t| | |
days[t.created_at.strftime('%A')] += 1 if t == t.user.transactions.first(:order => 'created_at') | |
end | |
puts days.sort{|a,b| b[1]<=>a[1]}.inspect | |
end | |
# [["Saturday", 44], ["Sunday", 62], ["Friday", 69], ["Monday", 80], ["Thursday", 93], ["Tuesday", 110], ["Wednesday", 115]] |
barmstrong:universitytutor$ rake sitemap:install --trace | |
(in /Users/barmstrong/NetBeansProjects/universitytutor) | |
** Invoke sitemap:install (first_time) | |
** Invoke sitemap:require (first_time) | |
** Execute sitemap:require | |
rake aborted! | |
no such file to load -- sitemap_generator | |
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require' | |
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' | |
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require' |
/Users/barmstrong/NetBeansProjects/viper/vendor/rails/railties/lib/commands/runner.rb:47: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/openssl/buffering.rb:178:in `syswrite': SSL_write:: ssl handshake failure (OpenSSL::SSL::SSLError) | |
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/openssl/buffering.rb:178:in `do_write' | |
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/openssl/buffering.rb:219:in `print' | |
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/imap.rb:1049:in `put_string' | |
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/imap.rb:1021:in `send_command' | |
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize' | |
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/imap.rb:1019:in `send_command' | |
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/ima |
# Ruby file to use the Google Prediction API, with a very hacked OAuth2 | |
# You'll want to replace all the custom variables including.. | |
# 1. Your google storage bucket name | |
# 2. Your google storage access credentials (note that gstore only works with "legacy" google storage access so you'll need to enabled this) | |
# 3. Your OAuth credentials which you setup from here https://code.google.com/apis/console/ by selecting "API Access" | |
# Note that I choose "Create client ID" and then "Installed Application". | |
# | |
# This script is intended to be run as a regular background process (like a cron job) to process data. It has no access to a browser and no web server to expose a callback url. Hence the hacking of OAuth2. This seems completely wrong to me but I haven't gotten any other authentication with the API to work. If anyone knows a better way please post a comment! | |
# |
class CreateOauth2s < ActiveRecord::Migration | |
def self.up | |
create_table :oauth2s do |t| | |
t.string :api | |
t.string :refresh_token | |
t.string :access_token | |
t.datetime :expires_at | |
t.timestamps | |
end |
#!/usr/bin/env ruby | |
## as seen on http://nerds.airbnb.com/monitoring-your-serverswith-fire | |
THRESHOLD = 1000 # milliseconds | |
flame_on = false | |
def log ms, msg | |
puts "#{Time.now.to_s} \t #{ms}ms \t #{msg}" | |
end |
require 'sunspot' | |
require 'mongoid' | |
require 'sunspot/rails' | |
class Post | |
include Mongoid::Document | |
field :title | |
include Sunspot::Mongoid | |
searchable do | |
text :title |
<div class="coinbase-button" data-code="818bdfa54c1525d774440edbd267ee60"></div> | |
<script src="https://coinbase.com/assets/button.js" type="text/javascript"></script> |