THIS GIST WAS MOVED TO TERMSTANDARD/COLORS
REPOSITORY.
PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!
function formatXml(xml) { | |
var formatted = ''; | |
var reg = /(>)(<)(\/*)/g; | |
xml = xml.toString().replace(reg, '$1\r\n$2$3'); | |
var pad = 0; | |
var nodes = xml.split('\r\n'); | |
for(var n in nodes) { | |
var node = nodes[n]; | |
var indent = 0; | |
if (node.match(/.+<\/\w[^>]*>$/)) { |
namespace :deploy do | |
task :upload do | |
files = (ENV["FILES"] || "").split(",").map { |f| Dir[f.strip] }.flatten | |
abort "Please specify at least one file or directory to update (via the FILES environment variable)" if files.empty? | |
on release_roles :all do | |
files.each { |file| upload!(file, File.join(current_path, file)) } | |
end | |
end | |
end |
THIS GIST WAS MOVED TO TERMSTANDARD/COLORS
REPOSITORY.
PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!
NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths
Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.
hg clone https://bitbucket.org/ZyX_I/vim | |
cd vim | |
hg update 24-bit-xterm | |
cd src && make autoconf && cd .. | |
./configure \ | |
--enable-gui=no \ | |
--without-x \ | |
--enable-multibyte \ | |
--with-tlib=ncurses \ |
# config/locales/en.rb | |
{ | |
:en => { | |
:activerecord => { | |
:errors => { | |
:models => { | |
:bid => { | |
:price_too_low => lambda { |errors,attributes| | |
helpers = ActionController::Base.helpers | |
currency = attributes[:price] || 0 |
Maybe you're listening to your favourite song on Rdio, or maybe checking your Soundcloud stream. You reach for the play/pause key on your keyboard and BAM, motherfucking iTunes comes up. Don't you hate that? I do.
Luckily, there's a way to fix it. Open your terminal and type:
launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist
Voilà, iTunes no longer responds to the media keys. The only downside is that now iTunes doesn't respond to the media keys at all. I couldn't care less, but if you're a crazy person who actually likes iTunes (poor you!), you can reattach the keys at any time with:
rivets.configure({ | |
adapter: { | |
subscribe: function(obj, keypath, callback) { | |
if (obj instanceof Backbone.Collection) { | |
obj.on('add remove reset', function () { | |
callback(obj[keypath]) | |
}); | |
} else { | |
obj.on('change:' + keypath, function (m, v) { callback(v) }); | |
}; |
#!/usr/bin/python | |
# CLI program to control the mediakeys on OS X. Used to emulate the mediakey on a keyboard with no such keys. | |
# Easiest used in combination with a launcher/trigger software such as Quicksilver. | |
# Main part taken from http://stackoverflow.com/questions/11045814/emulate-media-key-press-on-mac | |
# Glue to make it into cli program by Fredrik Wallner http://www.wallner.nu/fredrik/ | |
import Quartz | |
import sys |