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/env ruby | |
# Pipe to Safari. Use like this: | |
# chmod +x safari.rb | |
# curl site.com/api/foo | safari.rb | |
File.open("/tmp/to_safari.html", "w") do |f| | |
f.write ARGF.read | |
end | |
`open -a 'Safari' /tmp/to_safari.html` |
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 Kernel | |
def pbpaste | |
`pbpaste` | |
end | |
def pbcopy(object) | |
IO.popen('pbcopy', 'w') { |pb| pb << object.to_s } | |
end | |
def pbfilter(filter) |
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
[alias] | |
sha = log -1 --pretty=format:%H | |
cpsha = !git sha | pbcopy |
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
# This seems somewhat silly, but in Rails (at least as of version 3.0.6), the | |
# Hash.from_xml method seems to consider a single newline so important that it | |
# will not parse any of the tag attributes, instead returning just the newline. | |
# This middleware fixes that by stripping out those newlines. | |
# | |
# The bug is fixed by a commit to rails that is not yet included in a 3.0.x | |
# release as of 2011-04-14. Hopefully this middleware can be removed once the | |
# next 3.0.x release comes out. | |
# https://github.com/rails/rails/commit/b41d8f30debc92ac24003d42c0b50a1d6e36cfa1 | |
class HashFromXmlFixer |
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
# You must require this file in application.rb, above the Application | |
# definition, for this to work. For example: | |
# | |
# # Syslog-like Rails logs | |
# if Rails.env.production? | |
# require File.expand_path('../../lib/better_logger', __FILE__) | |
# end | |
# | |
# module MyApp | |
# class Application < Rails::Application |
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
/* Put this in ~/Library/KeyBindings/DefaultKeyBinding.dict */ | |
/* Based on a file from @eventualbuddha */ | |
{ | |
/* Modifier keys: start with C-m */ | |
"^m" = { | |
"^ " = ("insertText:", "\U2423"); /* C-space space */ | |
"^e" = ("insertText:", "\U21A9"); /* C-e return */ | |
"e" = ("insertText:", "\U2305"); /* e enter */ |
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
<key>SafariOmnibar_SearchProviders</key> | |
<array> | |
<dict> | |
<key>Name</key> | |
<string>Google</string> | |
<key>Keyword</key> | |
<string>g</string> | |
<key>Default</key> | |
<true/> | |
<key>SearchURLTemplate</key> |
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
# Screen-compatible update_terminal_cwd() | |
update_terminal_cwd() { | |
# Identify the directory using a "file:" scheme URL, | |
# including the host name to disambiguate local vs. | |
# remote connections. Percent-escape spaces. | |
local SEARCH=' ' | |
local REPLACE='%20' | |
local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}" | |
# Include the escapes needed for screen to forward to Terminal.app | |
printf '\eP\e]7;%s\a\e\\' "$PWD_URL" |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" | |
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>KeepAlive</key> | |
<true/> | |
<key>Label</key> | |
<string>com.mysql.mysqld</string> | |
<key>Program</key> |
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
$ type -a psg | |
psg is a function | |
psg () | |
{ | |
ps wwwaux | egrep -i "($1|%CPU)" | grep --colour=auto -v grep | |
} | |