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 to_h_time(seconds_diff) | |
hours = seconds_diff / 3600 | |
seconds_diff -= hours * 3600 | |
minutes = seconds_diff / 60 | |
seconds_diff -= minutes * 60 | |
seconds = seconds_diff | |
"#{hours.to_i.to_s.rjust(2, '0')}:#{minutes.to_i.to_s.rjust(2, '0')}:#{seconds.to_i.to_s.rjust(2, '0')}" |
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
# ---------------------------------------------------------------- | |
# FILE: launch_action_credits.rb | |
# ---------------------------------------------------------------- | |
# launch action credits | |
# to launch: prodrunner ~/launch_action_credits.rb | |
object_count = ActionCredit. | |
joins('LEFT OUTER JOIN action_credit_source_data ' + | |
'ON action_credits.id = action_credit_source_data.action_credit_id'). |
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 run_action_credit_updates(batch, idx) | |
report_size = 10_000 | |
batch.each_with_index do |b, i| | |
if i > 0 && i % report_size == 0 | |
puts "Batch #{idx} : #{i} (#{ 100 - ((report_size/i.to_f) * 100).to_i }%)" | |
end | |
b.set_source_data | |
end | |
puts "Batch #{idx} : Done" | |
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
Rebuilding your dev box with Shane's dot files | |
vim --version | |
should be 7.4 - if not | |
sudo yum install mercurial | |
cd ~ | |
hg clone https://vim.googlecode.com/hg/ vim | |
cd ~/vim |
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 TokensController < ApplicationController | |
skip_before_filter :verify_authenticity_token | |
respond_to :json | |
def create | |
email = params[:email] | |
password = params[:password] | |
if request.format != :json | |
render :status=>406, :json=>{:message=>"The request must be json"} | |
return |
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
# Job | |
add_column :current_batch_job_id # current batch job running | |
# This represents batch job runs - and provides history | |
create_table "batch_jobs", :force => true do |t| | |
t.integer "job_id" # job this is related to | |
t.string "state" # state: create, processed, running, failed, stopped, finished | |
t.integer "instances_to_create" # count of the planned number of instances to create | |
t.datetime "created_at" | |
t.datetime "updated_at" |
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
# I have this timer setup. It's the only way I could get it to work but seems very wrong... | |
# Specifically in processUserCommand if I don't clearTimeout's every time the win and max | |
# moves scenarios no longer work. Without the timer tear down the app just goes on and on | |
# after reaching max moves and/or win. | |
# Full code up on https://github.com/wiseleyb/solitr | |
# Sample app up on http://solitr.herokuapp.com/klondike-turn-three-hints | |
window.timer = new App.AutoRun | |
window.timers = [] |
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
rasputin:wordsquared wiseleyb$ git diff Gemfile.lock | |
diff --git a/Gemfile.lock b/Gemfile.lock | |
index cc897f5..33d8652 100644 | |
--- a/Gemfile.lock | |
+++ b/Gemfile.lock | |
@@ -1,76 +1,77 @@ | |
GIT | |
remote: git://github.com/thedarkone/rails-dev-boost.git | |
- revision: e2716ad0bceefbd840528cc5de329de075b602e1 | |
+ revision: 6e093e559003d1986ab95b09a9e21197bb5d8edb |
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
#---------------------------------------------------------------------------------- | |
# CONTROLLER | |
#---------------------------------------------------------------------------------- | |
class MoneybookersPaymentsController < ApplicationController | |
layout :false | |
ssl_required :mbstatus, :mbreturn, :mbcancel if HTTPS |
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 Base < ActiveResource::Base | |
def reload | |
po = self.prefix_options.dup | |
super | |
self.prefix_options = po | |
return self | |
end | |
def save |