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
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 |
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
# 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! | |
# |
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
/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 |
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
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' |
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 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]] |
NewerOlder