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 DynamicActiveRecords | |
| def ar_class_for_table table | |
| klass = Class.new ActiveRecord::Base | |
| unique_module = Module.new | |
| DynamicActiveRecords.const_set "Id#{DynamicActiveRecords.unique_id}", unique_module | |
| unique_module.const_set table.classify, klass | |
| klass.class_eval "set_table_name '#{table}'" | |
| klass | |
| 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
| it "should combine complex parameters" do | |
| session = Webrat::MerbSession.new | |
| session.stub!(:response_body).and_return <<-EOS | |
| <form method="get" action="url"> | |
| <input name="a[b][c][x]" value="foo" /> | |
| <input name="a[b][c][y]" value="bar" /> | |
| <input type="submit" /> | |
| </form> | |
| EOS | |
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
| dslfkjdsafjsdalfs |
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
| # run very flat apps with merb -I <app file>. | |
| # Uncomment for DataMapper ORM | |
| # use_orm :datamapper | |
| # Uncomment for ActiveRecord ORM | |
| # use_orm :activerecord | |
| # Uncomment for Sequel ORM | |
| # use_orm :sequel |
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
| function! Run(command, ...) | |
| let command = a:command . " 2>&1" | |
| execute "botright copen" | |
| setlocal wrap | |
| setlocal modifiable | |
| normal ggdG | |
| if a:0 > 0 | |
| execute "normal ggi" . a:1 | |
| else |
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
| Given %r{I should see these strings in order} do |table| | |
| doc = Nokogiri.HTML(response.body) | |
| strings = table.raw.flatten | |
| # find all instances of the passed in strings | |
| escaped_strings = table.raw.flatten.map {|string| Regexp.escape(string)} | |
| snippet_regexp = Regexp.new escaped_strings.join("|"), Regexp::MULTILINE | |
| snippets = doc.inner_text.scan(snippet_regexp) | |
| # look for each string in order |
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 'spec_helper' | |
| require 'lib/static_map_uri' | |
| describe StaticMapURI do | |
| let(:address){ "123 foo st, grand rapids mi" } | |
| let(:width){ 200 } | |
| let(:height){ 100 } | |
| subject{ StaticMapURI.new address, width, height } | |
| its(:host){ should == "maps.google.com" } |
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
| (defmacro let-match [matches & code] | |
| `(if-match ~matches | |
| (do ~@code) | |
| (throw (UnsupportedOperationException. "Destructuring failed.")))) |
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
| ############################################ | |
| # spec/spec_helper.rb, in RSpec.configure block | |
| config.before do | |
| MongoidCleaner.start | |
| end | |
| config.after do | |
| MongoidCleaner.clean | |
| 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
| Register .NET 4 framework with IIS 7: | |
| ● Run cmd.exe | |
| ● cd C:\windows\microsoft.net\framework\v4.0.30319 | |
| ● aspnet_regiis.exe -r | |
| Install Web Deployment Tool | |
| ● http://www.iis.net/download/WebDeploy | |
| ● I chose to install "Complete" instead of the default "Typical" but | |
| I'm not sure this is | |
| necessary |