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
# it is my personal opinion that calling something a "plugin" implies that one should be able | |
# to "unplug" it as well. Therefore, rather than inserting my plugins' migrations into the | |
# stream of my app's plugins as is usually done with Desert, I prefer the method described | |
# in section 12.1 "Create A Custom Rake Task" of http://guides.rubyonrails.org/plugins.html. | |
# It seemed a bit un-DRY however, so here's a little something I drop in my plugins' lib | |
# directory: | |
module MigrationGetter | |
def with_migration_file(filename) | |
ActiveRecord::Migration.verbose = |
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
# Recently I was involved in rebuilding a client’s site that had previously used | |
# some old CMS system (in Java, source code not to be found) of our company’s, | |
# with our new one (in Ruby On Rails). I needed to reuse some of the original | |
# images. Turns out the old system kept images and various other files used on the | |
# site in the MySQL database, as BLOB objects. I came up with this quickie little | |
# script to pull the files out of the database and save then as good old fashioned | |
# files. | |
#!/usr/bin/env ruby | |
require 'rubygems' |
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
## Rails's mysql connection pool running dry because Thread#wait return value changed | |
## in ruby 1.9. This, by the way, is with Rails 2.3.14 so it's not just a 3.x thing | |
## https://rails.lighthouseapp.com/projects/8994/tickets/5736-connections-not-released-in-rails-3 edit | |
Processing WebpagesController#update (for 63.224.186.69 at 2011-10-02 15:16:48) [PUT] | |
[...parameters...] | |
Redirected to http://[redacted]/siteman/webpages/1/subpages | |
Completed in 26ms (DB: 19) | 302 Found [http://[redacted]/siteman/webpages/2] | |
/!\ FAILSAFE /!\ 2011-10-02 15:16:48 -0500 |
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
ruby-1.9.2-p290 :030 > a = proc{'eh'} | |
=> #<Proc:0x000001009ac850@(irb):30> | |
ruby-1.9.2-p290 :031 > a.() | |
=> "eh" | |
ruby-1.9.2-p290 :032 > a[] | |
=> "eh" | |
ruby-1.9.2-p290 :033 > a.call | |
=> "eh" | |
ruby-1.9.2-p290 :034 > def a.call; super + '?'; end | |
=> nil |
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
fibs = Enumerator.new do |y| | |
recent = [0,1] | |
loop do | |
y << recent.last | |
recent = (recent << recent[0..1].inject(:+)).pop(2) | |
end | |
end | |
fibs.first(20) #=> [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765] |
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
1 scenario (1 failed) | |
5 steps (1 failed, 3 skipped, 1 passed) | |
0m0.438s | |
rake aborted! | |
Command failed with status (1): [/Users/charleshoffman/.rvm/rubies/ruby-2.0...] | |
/Users/charleshoffman/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/file_utils.rb:53:in `block in create_shell_runner' | |
/Users/charleshoffman/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/file_utils.rb:45:in `call' | |
/Users/charleshoffman/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/file_utils.rb:45:in `sh' | |
/Users/charleshoffman/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/file_utils_ext.rb:37:in `sh' | |
/Users/charleshoffman/.rvm/gems/ruby-2.0.0-p0@aggress/gems/cucumber-1.2.5/lib/cucumber/rake/task.rb:104:in `run' |
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
# for those times when you have a static web site but then it turns out you | |
# need a contact form or some such. | |
# just sticking the whole site in public/ gets you most of the way there -- | |
# the web server just serves up anything it finds there without calling on | |
# your app for anything | |
# but that doesn't work for the default index.html page for paths like | |
# "/" or "/foo". |
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
### Keybase proof | |
I hereby claim: | |
* I am hoff2 on github. | |
* I am centipedefarmer (https://keybase.io/centipedefarmer) on keybase. | |
* I have a public key whose fingerprint is 65EE EFFD F4FF 4B3B 6F37 82A3 F8E7 1C46 A007 9449 | |
To claim this, I am signing this object: |
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
~ $ brew doctor | |
Error: undefined method `<' for nil:NilClass | |
Please report this bug: | |
https://git.io/brew-troubleshooting | |
/usr/local/Library/Homebrew/os/mac/xcode.rb:131:in `provides_autotools?' | |
/usr/local/Library/Homebrew/diagnostic.rb:1038:in `check_for_autoconf' | |
/usr/local/Library/Homebrew/cmd/doctor.rb:30:in `block in doctor' | |
/usr/local/Library/Homebrew/cmd/doctor.rb:23:in `each' | |
/usr/local/Library/Homebrew/cmd/doctor.rb:23:in `doctor' | |
/usr/local/Library/brew.rb:143:in `<main>' |
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
~/dev/gripds-integration-tests(master) $ big up -d | |
run docker-compose -f /Users/chuckhoffman/dev/big/current-compose.yml up -d from "/Users/chuckhoffman/dev/big" | |
Starting big_zookeeper_1 | |
Starting big_citydata-solr_1 | |
Starting big_merchants-solr_1 | |
Starting big_redis_1 | |
Starting big_core-fetch_1 | |
Starting big_dns_1 | |
Starting big_hbase35_1 | |
Starting big_grip-admin_1 |
OlderNewer