This file contains hidden or 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
| by the end of 2010 I will... | |
| - on the cards | |
| ✘ fail, or rejected | |
| ✔ complete | |
| physically: | |
| ✘ Lead an indoor grade 20+ sport climb [can almost onsite some 19s top rope, still need to learn to lead] | |
| ✔ Lead a multi-pitch trad climb [didn't learn how to use gear] | |
| ✘ 5 minute plank [going well, less than 90s away] |
This file contains hidden or 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
| # Monkey patch in CTRL-C support for rspec from | |
| # http://github.com/dchelimsky/rspec/commit/029f77c5063894cf52af05335b8e1c278411978b | |
| # until it gets released | |
| module Spec | |
| module Example | |
| module ExampleMethods | |
| def execute(run_options, instance_variables) # :nodoc: | |
| run_options.reporter.example_started(@_proxy) | |
| set_instance_variables_from_hash(instance_variables) |
This file contains hidden or 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 'rubygems' | |
| require 'hpricot' | |
| require 'fastercsv' | |
| doc = Hpricot::XML(File.read(ARGV[0])) | |
| csv = FasterCSV.generate do |csv| | |
| (doc/:Trackpoint).each do |x| | |
| next unless x.at('HeartRateBpm') && x.at('Position') | |
| csv << [ |
This file contains hidden or 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
| # In Rspec, gives you: | |
| # before(:all_transactional) {} | |
| # | |
| # Uses nested transactions to correctly rollback :all before blocks | |
| # You *may* need to reload some instance variables in a separate before(:each) block | |
| # All a bit of a hack, but really handy | |
| module RspecRailsTransactions | |
| def before_all_transactional_parts # :nodoc: | |
| @before_all_transactional_parts ||= [] | |
| end |
This file contains hidden or 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
| module ActiveRecord | |
| class Base | |
| def atomic &block | |
| transaction { | |
| lock! | |
| yield | |
| } | |
| end | |
| end | |
| end |
This file contains hidden or 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
| Title: | |
| Your database is your friend | |
| Description: | |
| Learn how going against rails conventions and using your database can make your | |
| life easier. A practical tutorial on data integrity and design. | |
| Type: | |
| 3 hour tutorial |
This file contains hidden or 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
| # DM Extensions | |
| # Use for roll your own optimistic locking, without using a dedicated lock_version column | |
| def update_with_conditions(attributes, conditions) | |
| properties = attributes.inject({}) do |a, (key, value)| | |
| a.update(property_by_name(key) => value) | |
| end | |
| updated_count = repository.adapter.update(properties, all(conditions)) |
This file contains hidden or 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
| # Add pessmistic locking support. Make sure you're inside a transaction. | |
| # resource = MyResource.get(24) | |
| # resource.lock! # write lock (FOR UPDATE) | |
| # | |
| # TODO: | |
| # resource = MyResource.get_with_lock!(:write, 24) | |
| # resource = MyResource.get_with_lock!(:read, 24) | |
| # MyResource.all(:lock => :write) | |
| module DataMapper |
This file contains hidden or 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
| # Hacks to get nested transactions in Postgres | |
| # Not extensively tested, more a proof of concept | |
| # | |
| # It re-opens the existing Transaction class to add a check for whether | |
| # we need a nested transaction or not, and adds a new NestedTransaction | |
| # transaction primitive that issues savepoint commands rather than begin/commit. | |
| module DataMapper | |
| module Resource | |
| def transaction(&block) |
This file contains hidden or 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
| Royal Melbourne Hospital - Vegan Menu | |
| Dinner: | |
| - Cucumber + Cheese sandwich | |
| - Orange Juice | |
| Dinner (2nd try): | |
| - Tomato/cucumber/carrot salad | |
| - Potato + corn + mayonnaise coleslaw | |
| - Jelly (gelatine) |