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
| (* | |
| Open a new tab in Safari (and move focus to the URL bar) | |
| I have this configured as a Quicksilver trigger for ctrl+alt+T | |
| *) | |
| tell application "Safari" to activate | |
| tell application "System Events" | |
| tell process "Safari" | |
| click menu item "New Tab" of menu "File" of menu bar 1 | |
| end tell |
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
| # A library for downloading issues of Harpers from the archives. | |
| # | |
| # To use, log in to the archives from your web browser. Then set the | |
| # HARPERS_ARCHIVE_COOKIE environment variable to the value of the .harpers.org | |
| # "archive" cookie, which you can find by visiting the following URL while on | |
| # the Harpers website: | |
| # | |
| # javascript:prompt("HARPERS_ARCHIVE_COOKIE",document.cookie.match(/(?:;|^)\s*archive=(.+?)(?:;|$)/)[1]) | |
| # | |
| # Example: |
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 template for Rails 2.3. Work in progress. | |
| # By Henrik Nyh (http://henrik.nyh.se) 2009-03-29. Public domain. | |
| # Usage: rails myapp -m http://gist.github.com/87341.txt | |
| META_AUTHOR = "Henrik Nyh (http://henrik.nyh.se)" | |
| JQUERY_VERSION = "1.3.2" | |
| APP_NAME = File.basename(Dir.pwd) | |
| git :init |
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 template for Rails 2.3. Work in progress. | |
| # By Henrik Nyh (http://henrik.nyh.se) 2009-03-29. Public domain. | |
| # Usage: rails myapp -m http://gist.github.com/87341.txt | |
| META_AUTHOR = "Henrik Nyh (http://henrik.nyh.se)" | |
| JQUERY_VERSION = "1.3.2" | |
| APP_NAME = File.basename(Dir.pwd) | |
| git :init |
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
| # Mimic Mac OS X Finder's sort by name. | |
| class Array | |
| def finder_sort | |
| sort_by do |str| | |
| punctuation = %w[` ^ _ - , ; ! ? ' " ( ) [ ] { } @ *] + ['\\'] + %w[& # % + < = > | ~ $] | |
| str.to_s.gsub(/\d+|[^a-z\s]/i) do |match| | |
| if punctuation.include? match | |
| "1".rjust(200 - punctuation.index(match), "0") | |
| elsif match =~ /0+/ # make an exception for zeros | |
| "1".rjust(101, "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
| # $ tweet Hi mom! | |
| # | |
| # Put this in ~/.bashrc or wherever. | |
| # If it doesn't work, make sure your ~/.netrc is right | |
| # | |
| # (Thanks to @anildigital and @grundprinzip for curl-fu) | |
| function tweet { | |
| curl -n -d status="$*" https://twitter.com/statuses/update.xml --insecure &> /dev/null | |
| echo "tweet'd" |
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
| # download and git methods swiped from http://github.com/Sutto/rails-template/blob/07b044072f3fb0b40aea27b713ca61515250f5ec/rails_template.rb | |
| require 'open-uri' | |
| def download(from, to = from.split("/").last) | |
| #run "curl -s -L #{from} > #{to}" | |
| file to, open(from).read | |
| rescue | |
| puts "Can't get #{from} - Internet down?" | |
| exit! |
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
| # download and git methods swiped from http://github.com/Sutto/rails-template/blob/07b044072f3fb0b40aea27b713ca61515250f5ec/rails_template.rb | |
| require 'open-uri' | |
| def download(from, to = from.split("/").last) | |
| #run "curl -s -L #{from} > #{to}" | |
| file to, open(from).read | |
| rescue | |
| puts "Can't get #{from} - Internet down?" | |
| exit! |
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
| shared: &shared | |
| # Use different adapters with JRuby vs. MRI | |
| adapter: <%= defined?(JRuby) ? "jdbcmysql" : "mysql" %> | |
| encoding: utf8 | |
| username: root | |
| password: | |
| host: localhost | |
| socket: /opt/local/var/run/mysql5/mysqld.sock | |
| <% |
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
| // In most browsers, a <label> tag around a form field, e.g.: | |
| // | |
| // <label> | |
| // <input type="checkbox" id="private" name="private"> | |
| // This message is private | |
| // </label> | |
| // | |
| // works just as if you'd specified a for= attribute on the label | |
| // for the first visible field inside the label. In Safari 4, this | |
| // seems not to be the case (i.e. the for= attribute is required). |