Skip to content

Instantly share code, notes, and snippets.

@smtlaissezfaire
smtlaissezfaire / test.txt
Created April 7, 2018 18:26
data for testing linear regressions
xs = [
10,
9,
8,
7,
6,
5,
4,
3,
2,
require 'markaby'
module Markaby
module Rails
class TemplateHandler
class << self
def register!
ActionView::Template.register_template_handler(:mab, new)
end
diff --git a/lib/mongo_mapper/plugins/counter_cache.rb b/lib/mongo_mapper/plugins/counter_cache.rb
index 7505b6b..92934cf 100644
--- a/lib/mongo_mapper/plugins/counter_cache.rb
+++ b/lib/mongo_mapper/plugins/counter_cache.rb
@@ -49,29 +49,48 @@ module MongoMapper
raise InvalidCounterCacheError, "You must define an association with name `#{association_name}' on model #{self}"
end
- association_class = association.klass
- key_names = association_class.keys.keys
def first(options={})
return nil if ids.blank?
if sorted?
matched_ids = klass.collection.distinct(:_id, query(options).criteria.to_hash)
return nil if matched_ids.blank?
matched_ids.sort_by! { |matched_id| ids.index(matched_id) }
find!(matched_ids.first)
else
query(options).first
{
"driver": ["sauce"],
"driver.sauce": {
"user": "my-user-name",
"key": "my-key"
}
}
Scotts-MacBook-Air-5:web(master) smtlaissezfaire$ dalek -l 5 dalek/*_test.js -d sauce
Running tests
☁ [SYSTEM] dalek-internal-driver: Loading driver: "sauce"
>> ERROR: TypeError: Cannot read property '0' of null
Scotts-Mac-Pro:~ smt$ io
Io 20110905
Io> 1
==> 1
Io> 1
==> 1
Io> 1
==> 1
Io> 1
==> 1
class SendgridEventsMiddleware
def initialize(app)
@app = app
end
def call(env)
# Sendgrid's batch API doesn't send valid json (but sets the Content-Type header to application/json)
# This fixes the request body to send valid json.
#
# http://community.sendgrid.com/sendgrid/topics/batched_events_dont_seem_to_send_valid_json
/*
* jQuery Reveal Plugin 1.0
* www.ZURB.com
* Copyright 2010, ZURB
* Free to use under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*/
(function ($) {