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
| <script type="text/javascript"> | |
| // See MDN: https://developer.mozilla.org/en-US/docs/DOM/MutationObserver?redirectlocale=en-US&redirectslug=DOM%2FDOM_Mutation_Observers | |
| (function(){ | |
| // select the target node | |
| var target = document.querySelector('body'); | |
| var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; | |
| var i={}; | |
| // create an observer instance | |
| var observer = new MutationObserver(function(mutations) { |
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
| # http://ariejan.net/2011/09/24/rspec-speed-up-by-tweaking-ruby-garbage-collection | |
| # | |
| # Usage: | |
| # DEFER_GC=10 rspec spec/ | |
| # DEFER_GC=10 cucumber features/ | |
| # | |
| # put it to spec/support/deferred_garbage_collection_all_in_one.rb | |
| # or feature/support/hooks.rb | |
| class DeferredGarbageCollection | |
| DEFERRED_GC_THRESHOLD = (ENV['DEFER_GC'] || -1).to_f |
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
| # My intention is to be able to do this: | |
| # | |
| # from within some view, render a partial | |
| # with the added flavour that the partial is not a file | |
| # but rather a table model instance - like say a Customer, | |
| # a PurchaseOrder, or in this case - a Template | |
| # the partial rendering "should" adhere to all the standard Rails | |
| # magic, ie nested rendering of partials, builders with Erb/HAML, | |
| # I18n translation support to label the most important. |
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
| # usage: | |
| # it "should return a result of 5" do | |
| # eventually { long_running_thing.result.should eq(5) } | |
| # end | |
| module AsyncHelper | |
| def eventually(:options = {}) | |
| timeout = options[:timeout] || 2 | |
| interval = options[:interval] || 0.1 | |
| time_limit = Time.now + timeout | |
| loop do |
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
| namespace :db do | |
| desc "Clear all tables" | |
| task :clear => :environment do | |
| conn = ActiveRecord::Base.connection | |
| conn.tables.select{|t| t.start_with? ActiveRecord::Base.table_name_prefix }.each do |t| | |
| conn.drop_table t | |
| end | |
| end | |
| desc "Dump database into an SQL file" |
NewerOlder