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
belongs_to :plan | |
before_create :set_trial_end | |
def set_trial_end | |
plan = Plan.find(4) | |
end_of_trial = self.created_at + plan.trial_duration.days | |
self.trial_end_date = end_of_trial | |
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 bandwidth_usage(days) | |
beginning = Time.now.advance(:days => -days) | |
x = self.server_logs.where("created_at > ?", beginning) | |
netin = 0 | |
netout = 0 | |
for i in (0..(x.size-2)) # avoid last record | |
time_in_distance = (x[i+1].created_at - x[i].created_at) | |
netin += x[i].net_in * time_in_distance | |
netout += x[i].net_out * time_in_distance | |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<hosts> | |
<host> | |
<name>ota-db1</name> | |
<dell_service_tag>ASDVB</dell_service_tag> | |
<make_model>Dell PowerEdge R610</make_model> | |
<os> | |
<os_name>CentOS x86_64</os_name> | |
<os_version>5.2</os_version> | |
</os> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<hosts> | |
<title>PT Smart Complete Configuration V1.1</title> | |
<url>http://url.com/complete_configuration/11</url> | |
<description>Customer OTAF Configuration Description</description> | |
<host> | |
<name>ota-db1</name> | |
<dell_service_tag>ASDVB</dell_service_tag> | |
<make_model>Dell PowerEdge R610</make_model> | |
<os> |
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
source 'http://rubygems.org' | |
gem 'rails', '3.1.1' | |
# Bundle edge Rails instead: | |
# gem 'rails', :git => 'git://github.com/rails/rails.git' | |
gem 'mysql2' | |
gem 'pg' |
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
source 'http://rubygems.org' | |
gem 'rails', '3.1.1' | |
# Bundle edge Rails instead: | |
# gem 'rails', :git => 'git://github.com/rails/rails.git' | |
gem 'mysql2' | |
gem 'pg' |
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
source 'http://rubygems.org' | |
gem 'rails', '3.1.1' | |
# Bundle edge Rails instead: | |
# gem 'rails', :git => 'git://github.com/rails/rails.git' | |
gem 'mysql2' | |
gem 'pg' |
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
module DatatablesRails | |
class Structify | |
attr_accessor :struct | |
def initialize(data) | |
@struct = {} | |
@struct = data.collect{|d| d.attributes } | |
end | |
def formatter(&block) | |
#block.call(@struct) |
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
desc 'Ping pubsubhubbub server.' | |
task :ping do | |
require 'cgi' | |
require 'net/http' | |
http = Net::HTTP.new('pubsubhubbub.appspot.com', 80) | |
path = '/publish' | |
headers = {'Content-Type' => "application/x-www-form-urlencoded"} | |
data = 'hub.mode=publish&hub.url=http://bluescripts.net/atom.xml' |
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
2011-11-27T04:27:27+00:00 heroku[router]: GET app.classopoly.com/ dyno=web.1 queue=0 wait=0ms service=16ms status=200 bytes=1247 | |
2011-11-27T04:27:27+00:00 app[web.1]: | |
2011-11-27T04:27:27+00:00 app[web.1]: | |
2011-11-27T04:27:27+00:00 app[web.1]: Started GET "/" for 98.230.1.143 at 2011-11-26 20:27:27 -0800 | |
2011-11-27T04:27:27+00:00 app[web.1]: Completed 200 OK in 9ms (Views: 3.3ms | ActiveRecord: 4.5ms) | |
2011-11-27T04:27:29+00:00 app[web.1]: cache: [GET /user_courses] miss | |
2011-11-27T04:27:31+00:00 heroku[router]: GET app.classopoly.com/ dyno=web.1 que | |
2011-11-27T04:27:32+00:00 app[web.1]: | |
2011-11-27T04:27:32+00:00 app[web.1]: |