Skip to content

Instantly share code, notes, and snippets.

@mkb
mkb / gist:1040784
Created June 22, 2011 18:43
Prevent infinite loop in Autotest by ignoring volatile files
Autotest.add_hook :initialize do |at|
# Prevent infinite loops by ignoring volatile files
%w{.git vendordb log tmp .DS_store Gemfile.lock}.each do |exception|
at.add_exception(exception)
end
end
@mkb
mkb / gist:1050659
Created June 28, 2011 07:19
Color scheme for multitail and Pow logs
# % cd ~/Library/Logs/Pow/apps
# % multitail --config <some path>/multitail.conf -CS pow app1.log app2.log ...
colorscheme:pow:
cs_re:blue::
cs_re:cyan:^\[[^]]*]
cs_re:red:ERROR
cs_re:yellow:WARNING
cs_re:green:NOTICE
cs_re:magenta:DEBUG
@mkb
mkb / gist:1101986
Created July 23, 2011 23:09
Apps I need Lion-friendly before I can upgrade:

Do not pass go, do not collect $30

  • TextMate
  • OmniFocus
  • Quicksilver
  • 1Password
  • Colloquy
  • Dropbox
  • Evernote
  • GitX (preferably the fork)
@mkb
mkb / gist:1119690
Created August 2, 2011 06:27
Using an unreleased gem version with Bundler

TL;DR

Do this:

gem 'nokogiri'
gem 'w3c_validators', "1.1.1", :git => 'git://github.com/alexdunae/w3c_validators.git'

Why?

After experiencing trouble with the w3c_validators gem, I discovered that the problem was a known bug. A fix has been committed, but not yet released in gem form. I could have gone with an older version of the gem, but instead tweaked my Gemfile (ie, Bundler) to use the latest and greatest code.

@mkb
mkb / end.scpt
Created August 2, 2011 06:58
Colloquy away/back scripts for Pomodoro.app
tell application "System Events" to if exists process "Colloquy" then
tell application "Colloquy"
set aC to every connection
repeat with c in aC
set aR to (every chat room of c)
repeat with r in aR
set away message of c to ""
end repeat
end repeat
end tell
@mkb
mkb / gist:1218376
Created September 15, 2011 02:31
#!/usr/bin/env ruby -wKU
LOG = 'eventcmd.log'
event = ARGV.first
@message = 'Gug.'
def ichat_message
%Q{set status message to "#{@message}"}
end
mkb@chongo ~ % rvm install 1.8.7
Installing Ruby from source to: /Users/mkb/.rvm/rubies/ruby-1.8.7-p352, this may take a while depending on your cpu(s)...
ruby-1.8.7-p352 - #fetching
ruby-1.8.7-p352 - #extracting ruby-1.8.7-p352 to /Users/mkb/.rvm/src/ruby-1.8.7-p352
mv: rename /Users/mkb/.rvm/tmp/rvm_src_59540/\033[34mruby-1.8.7-p352\033[39;49m\033[0m to /Users/mkb/.rvm/src/ruby-1.8.7-p352: No such file or directory
ruby-1.8.7-p352 - #extracted to /Users/mkb/.rvm/src/ruby-1.8.7-p352
/Users/mkb/.rvm/scripts/functions/manage/base: line 163: cd: /Users/mkb/.rvm/src/ruby-1.8.7-p352: No such file or directory
ERROR: Source directory is missing.
Did the download or extraction fail?
ActiveSupport::Notifications.instrument("cheezburger", :extra => :information) do
# Do stuff.
end
ActiveSupport::Notifications.subscribe(/cheezburger/) do |*args|
puts "K THX BAI"
end
connection = Excon.new('http://icanhascheezburger.com/',
:instrumentor => ActiveSupport::Notifications,
:instrumentor_name => 'myapp.excon')
# Elsewhere...
ActiveSupport::Notifications.subscribe(/myapp.excon/) do |*args|
puts "Excon did stuff!"
end