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
# { Pivot Point Breakout Copyright 2011, P.J.Kaufman. All rights reserved. } | |
# | |
# inputs: period(3); | |
# vars: startday(0), ix(0), lasthigh(0), lastlow(0), lowpassed(false), size(0), | |
# investment(25000); | |
# | |
# | |
# startday = 2*period + 1; | |
# | |
# { test high pivot point } |
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
xs = [ | |
10, | |
9, | |
8, | |
7, | |
6, | |
5, | |
4, | |
3, | |
2, |
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
require 'markaby' | |
module Markaby | |
module Rails | |
class TemplateHandler | |
class << self | |
def register! | |
ActionView::Template.register_template_handler(:mab, new) | |
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
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 |
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 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 |
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
{ | |
"driver": ["sauce"], | |
"driver.sauce": { | |
"user": "my-user-name", | |
"key": "my-key" | |
} | |
} |
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
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 |
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
Scotts-Mac-Pro:~ smt$ io | |
Io 20110905 | |
Io> 1 | |
==> 1 | |
Io> 1 | |
==> 1 | |
Io> 1 | |
==> 1 | |
Io> 1 | |
==> 1 |
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 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 |
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
/* | |
* 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 ($) { |