Skip to content

Instantly share code, notes, and snippets.

View d3chapma's full-sized avatar

David Chapman d3chapma

  • Teldio
  • Ottawa, Canada
  • 00:05 (UTC -05:00)
  • X @d3chapma
View GitHub Profile
@d3chapma
d3chapma / share_results.html.haml
Created February 27, 2012 15:59
Javascript and Haml
- variables = { :contact_first_name => @contact.first_name, :user_full_name => @user.name, :user_first_name => @user.first_name }
= @email.intro_html(variables)
%p= "Please click the link below to go directly to the results of #{@user.first_name}'s assessment. You can also access an analysis of that assessment from that page."
%p= share_results_url(@token)
= @email.conclusion_html(variables)
@d3chapma
d3chapma / Framework Trace
Created March 16, 2012 15:26
Error after upgrading to Rails 3.1.4
vendor/plugins/newrelic_rpm/lib/new_relic/agent/instrumentation/active_record_instrumentation.rb:18:in `log_with_newrelic_instrumentation'
/gems/activerecord-3.1.4/lib/active_record/connection_adapters/sqlite_adapter.rb:234:in `exec_query'
/gems/activerecord-3.1.4/lib/active_record/connection_adapters/sqlite_adapter.rb:449:in `table_structure'
/gems/activerecord-3.1.4/lib/active_record/connection_adapters/sqlite_adapter.rb:333:in `columns'
/gems/activerecord-3.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:95:in `block (2 levels) in initialize'
/gems/activerecord-3.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:185:in `with_connection'
/gems/activerecord-3.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:92:in `block in initialize'
/gems/activerecord-3.1.4/lib/active_record/base.rb:712:in `yield'
/gems/activerecord-3.1.4/lib/active_record/base.rb:712:in `default'
/gems/activerecord-3.1.4/lib/active_record/base.rb:712:in `columns'
Uncaught TypeError: Object function Spreadsheet() {
return Spreadsheet.__super__.constructor.apply(this, arguments);
} has no method 'toJSON' backbone.marionette.js:1785
Marionette.CompositeView.Marionette.CollectionView.extend.serializeData backbone.marionette.js:1785
Marionette.CompositeView.Marionette.CollectionView.extend.renderModel backbone.marionette.js:1827
Marionette.CompositeView.Marionette.CollectionView.extend.render backbone.marionette.js:1800
_.extend.show backbone.marionette.js:910
List.Controller.showSpreadsheetsNav list_controller.js:25
(anonymous function) list_controller.js:11
triggerEvents backbone.js:203
{"name"=>"Repeater",
"table_id"=>"repeater",
"id"=>"2677",
"manufacturer"=>"asdf",
"model_number"=>"",
"ethernet_ip"=>"",
"subnet_mask"=>"",
"gateway_ip"=>"",
"radio_id"=>"",
"radio_model"=>"",
{"id"=>"341",
"name"=>"Repeater",
"notes"=>"asdf",
"key"=>"-4",
"property_instances"=>
[{"name"=>"Model Number", "value"=>""},
{"name"=>"Radio ID", "value"=>""},
{"name"=>"Radio Model", "value"=>""},
{"name"=>"Serial Number", "value"=>""},
{"name"=>"Firmware Version", "value"=>""},
#PROPERTY BACKBONE MODEL ATTRIBUTES
Object {id: 622, name: "Manufacturer", value: "asdf", visible: false, resource_instance_id: 350}
#PARAMS FOR THE REQUEST TO RAILS API
{"id"=>"622",
"name"=>"Manufacturer",
"value"=>"asdf",
"visible"=>true,
class List.SpreadsheetView extends App.Views.CompositeView
template: 'spreadsheets/list/_spreadsheet'
itemView: List.SpreadsheetRow
tagName: 'table'
className: 'table'
itemViewContainer: 'tbody'
class List.SpreadsheetRow extends App.Views.CollectionView
tagName: 'tr'
itemView: List.SpreadsheetCell
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
Entities.Resource = (function(_super) {
__extends(Resource, _super);
function Resource() {
return Resource.__super__.constructor.apply(this, arguments);
}
@d3chapma
d3chapma / gist:6390235
Last active December 22, 2015 00:38 — forked from bruth/gist:2865951
Removed the assumption about get requests. Added a check if the client is online or not. If not online, just queue the request because we know the request will fail.
# Reference Backbone ajax function
_ajax = Backbone.ajax
requestQueue = []
requestPending = false
sendRequest = (options, promise, trigger=true) ->
options = _.clone options
if trigger
requestPending = true
MacBook Pro
13-inch, Mid 2012
Processor 2.5 GHz Intel Core i5
Memory 4 GB 1600 MHz DDR3
Graphics Intel HD Graphics 4000 512 MB
Serial Number C1MJ2HKGDTY3
Software OS X 10.8.5 (12F45)