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
| Load up Terminal (Applications > Utilities > Terminal.app) and type the following. | |
| sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist | |
| To turn it back on, just do the opposite: | |
| sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist |
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
| { | |
| /* ~/Library/KeyBindings/DefaultKeyBinding.dict | |
| See https://gist.github.com/zsimic/1367779, prefix cheatsheet: | |
| Char Short Key | |
| $ S- Shift ⇧ | |
| ^ C- CTRL ⌃ | |
| ~ O- Option ⌥ (⊞ Win key position on PC) | |
| @ M- Command ⌘ (Alt position on PC) | |
| # Numeric Keypad |
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
| #!/bin/bash | |
| # | |
| # azilink for OS X Lion | |
| # based on http://pastie.org/405289 but works with Tunnelblick only | |
| # (no need to install a separate copy of OpenVPN2 from macports | |
| # or building from source by hand, thankfully) | |
| # Requires: | |
| # - azilink running on android phone (http://code.google.com/p/azilink/) | |
| # (run the app and check the box to start the service). | |
| # - adb on system path (comes with the Android SDK; |
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
| def transform_hash(original, options={}, &block) | |
| options[:safe_descent] ||= {} | |
| new_hash = {} | |
| options[:safe_descent][original.object_id] = new_hash | |
| original.inject(new_hash) { |result, (key,value)| | |
| if (options[:deep] && Hash === value) | |
| value = options[:safe_descent].fetch( value.object_id ) { | |
| transform_hash(value, options, &block) | |
| } | |
| end |
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
| # Add all gems in the global gemset to the $LOAD_PATH so they can be used in rails3 console with bundler | |
| if defined?(::Bundler) | |
| $LOAD_PATH.concat Dir.glob("#{ENV['rvm_path']}/gems/#{ENV['rvm_ruby_string']}@global/gems/*/lib") | |
| end |
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 | |
| require "irb" | |
| load "#{ENV['HOME']}/.irbrc" | |
| def IRB.run_config; end | |
| ARGV.unshift "console" | |
| load File.dirname(__FILE__) + "/rails" |
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
| require 'rack/utils' | |
| module Rack | |
| # | |
| # EnforceSSL is a Rack middleware app that enforces that users visit | |
| # specific paths via HTTPS. If a sensitive path is requested over | |
| # plain-text HTTP, a 307 Redirect will be issued leading to the HTTPS | |
| # version of the Requested URI. | |
| # | |
| # MIT License - Hal Brodigan (postmodern.mod3 at gmail.com) |
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
| # :PUBLISHER: markdown, shell, { command: 'rdiscount' } | |
| # :BRACKET_CODE: '[ruby]', '[/ruby]' | |
| # :TEXT: | |
| # | |
| # Have you ever started a long operation and walked away from the computer, and | |
| # come back half an hour later only to find that the process is hung up waiting | |
| # for some user input? It's a sub-optimal user experience, and in many cases it | |
| # can be avoided by having the program choose a default if the user doesn't | |
| # respond within a certain amount of time. One example of this UI technique in | |
| # the wild is powering off your computer - most modern operating systems will |
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
| Patch to `/usr/libexec/path_helper` to prevent hangs with long `PATH`s. | |
| --- path_helper_bak 2009-05-07 15:54:37.000000000 +0200 | |
| +++ path_helper 2009-06-04 10:51:39.000000000 +0200 | |
| @@ -15,7 +15,7 @@ | |
| for f in "$DIR" "$DIR".d/* ; do | |
| if [ -f "$f" ]; then | |
| for p in $(< "$f") ; do | |
| - [[ "$NEWPATH" = *(*:)${p}*(:*) ]] && continue | |
| + egrep -q "(^|${SEP})${p}($|${SEP})" <<<"$NEWPATH" && continue | |
| [ ! -z "$NEWPATH" ] && SEP=":" |
NewerOlder