Skip to content

Instantly share code, notes, and snippets.

View mikebaldry's full-sized avatar

Michael Baldry mikebaldry

View GitHub Profile
has_one :latest_successful_audit_factor_change,
class_name: "AuditFactorChange",
primary_key: "san",
foreign_key: "san",
conditions: {status: "Complete"},
order: "finished_at DESC"
given
| date | num |
| 01/11/12 | 1 |
| 02/11/12 | 1 |
| 03/11/12 | 3 |
| 04/11/12 | 3 |
| 05/11/12 | 3 |
| 06/11/12 | 3 |
| 07/11/12 | 4 |
class ClickTracking
constructor: ->
@lastX = -1
@lastY = -1
this._hookEvent()
$(document).on "click", "*", (e) =>
this._trackClick(e)
class VersionDetection
constructor: (@persistentStorage, @callbacks) ->
execute: ->
installedVersion = this._parseVersion @persistentStorage["installedVersion"]
version = this._parseVersion this._getVersion()
return this._onInstalled(version) unless installedVersion
return if installedVersion.string == version.string
checkToken: (token, cb) ->
@sql.query "SELECT id FROM users WHERE login = ? AND cti_token = ?", [@login, token], (err, result) ->
cb result.length == 1
class Model
def duration=(value)
self.float_duration = process(value)
end
def duration
unprocess(self.float_duration)
end
end
class Campaign < ActiveRecord::Base
has_many :daily_data
attr_accessible :start_date
def last_day_of_consecutive_daily_data
# meh
end
end
def merge_json_params
body = request.body.read
request.body.rewind
params.merge!(ActiveSupport::JSON.decode(body)) if body != "" && request.format.json?
end
def screenshot!
path = Tempfile.new(["ss", ".png"]).path
save_screenshot(path, full: true)
sleep 2
system("open #{path}")
sleep 1
end
def inspector!
page.driver.debug
@mikebaldry
mikebaldry / result
Created September 16, 2013 14:40
Rails asset_host failure
Failure/Error: expect(helper.image_url("blah.jpg")).to eq("http://this-is-a-test.com/assets/blah.jpg")
expected: "http://this-is-a-test.com/assets/blah.jpg"
got: "http://test.hosthttp://this-is-a-test.com/assets/blah.jpg"
(compared using ==)