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
| class Override | |
| # This assoc method is designed as a helpful tool to work around a shortcoming I found with Factory Girl's inability | |
| # to associate records created by other factories. Instead of sharing previously created factories, | |
| # it was creating duplicate records when associating records. | |
| def self.assoc(record, model_name, factory_name = nil) | |
| factory_name = model_name if factory_name.nil? | |
| existing_factory = eval("@#{model_name}") | |
| #puts "existing_factory: #{existing_factory}, model_name: #{model_name}, factory_name: #{factory_name}, model: #{model_name.to_s.camelize.constantize.name}" | |
| #puts "#{model_name.to_s.camelize.constantize.find_by_oid(Factory.stub(factory_name).oid)}" |
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
| #!/bin/bash | |
| mkdir /tmp/chromedownload && cd /tmp/chromedownload | |
| curl http://build.chromium.org/buildbot/snapshots/chromium-rel-mac/LATEST -o /tmp/chromedownload/LATEST --silent && LATEST=`cat /tmp/chromedownload/LATEST` | |
| curl http://build.chromium.org/buildbot/snapshots/chromium-rel-mac/$LATEST/chrome-mac.zip -o /tmp/chromedownload/chrome-mac.zip --silent | |
| unzip -qq /tmp/chromedownload/chrome-mac.zip | |
| cp -R /tmp/chromedownload/chrome-mac/Chromium.app /Applications | |
| rm -rf /tmp/chromedownload |
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
| #!/usr/bin/ruby | |
| # This script will find how much memory is currently be used by Chromium on *nix systems | |
| lines = `ps aux | grep Chromium`.split(/\n/) | |
| total_mem = 0 | |
| regex = Regexp.new('^'+("([^\s]+\s+)"*6)+'.*') | |
| lines.each do |line| | |
| matches = line.match(regex) | |
| if matches |
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 "#{File.dirname(__FILE__)}/../../vendor/plugins/moonshine/lib/moonshine.rb" | |
| class ApplicationManifest < Moonshine::Manifest::Rails | |
| if deploy_stage == 'v1' | |
| configure({ | |
| :application => 'v1.domainname.com', | |
| :deploy_to => '/srv/v1.domainname', | |
| :domain => 'v1.domainname.com', | |
| :passenger => { | |
| :pool_idle_time => 0 |
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
| CmdUtils.CreateCommand( | |
| { | |
| name: "ruby", | |
| takes: {"function": noun_arb_text}, | |
| icon: "http://ruby-doc.org/favicon.ico", | |
| homepage: "http://jackndempsey.blogspot.com", | |
| author: {name: "Jack Dempsey", email: "[email protected]"}, | |
| license: "MPL,GPL", | |
| description: "Search ruby functions documentation", | |
| help: "Select a ruby function", |
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
| > ab -n 10 -c 10 http://127.0.0.1:3000/widgets | |
| This is ApacheBench, Version 2.3 <$Revision: 655654 $> | |
| Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ | |
| Licensed to The Apache Software Foundation, http://www.apache.org/ | |
| Benchmarking 127.0.0.1 (be patient).....done | |
| Server Software: thin |
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
| rails s thin -p 3001 | |
| => Booting Thin | |
| => Rails 3.0.0.rc application starting in development on http://0.0.0.0:3001 | |
| => Call with -d to detach | |
| => Ctrl-C to shutdown server | |
| You did not specify how you would like Rails to report deprecation notices for your development environment, please set config.active_support.deprecation to :log at config/environments/development.rb | |
| >> Thin web server (v1.2.7 codename No Hup) | |
| >> Maximum connections set to 1024 | |
| >> Listening on 0.0.0.0:3001, CTRL+C to stop |
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
| x = "foo" # => "foo" | |
| x.freeze # => "foo" | |
| y = x.clone # => "foo" | |
| y.frozen? # => true | |
| y = x.dup # => "foo" | |
| y.frozen? # => false |
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
| doc = APIDocumenter.new('./doc/api_doc_markdown.txt', './doc/api_doc.html') | |
| puts doc.table [['foo', 'bar']], ['h1', 'h2'] | |
| # result | |
| begin | |
| <table> | |
| <thead> | |
| <tr> | |
| <th>h1</th> | |
| <th>h2</th> |
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
| ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-dir=/usr/local --with-mysql-config=/usr/local/bin/mysql_config |