Skip to content

Instantly share code, notes, and snippets.

View kommen's full-sized avatar

Dieter Komendera kommen

View GitHub Profile
<% test_wrapping_helper do %>
some html
<% end %>
Process: Safari [43369]
Path: /Applications/WebKit.app/Contents/MacOS/WebKit
Identifier: org.webkit.nightly.WebKit
Version: r38297 (38297)
Code Type: X86 (Native)
Parent Process: launchd [111]
Date/Time: 2008-11-13 17:22:41.187 +0100
OS Version: Mac OS X 10.5.5 (9F33)
Report Version: 6
module Mocha
module ObjectMethods
def stub_path(path)
path = path.split('.') if path.is_a? String
raise "Invalid Argument" if path.empty?
part = path.shift
mock = Mocha::Mockery.instance.named_mock(part)
exp = self.stubs(part)
if path.length > 0
exp.returns(mock)
(?x)
\b
( # Capture 1: entire matched URL
(?:
[\w-]+: # URL protocol and colon
(?:
/{1,3} # 1-3 slashes
| # or
[[:alpha:][:digit:]] # Single letter or digit
# (Try not to match, say "URI::Escape")
What?
Command line tool to create hard links to directories with Mac OS X (10.5 or later). This is used by Time Machine.
Credits:
http://www.mactech.com/articles/mactech/Vol.23/23.11/ExploringLeopardwithDTrace/index.html
http://osxbook.com/blog/2008/11/09/hfsdebug-40-and-new-hfs-features/
Restrictions:
The hard link must be created in a directory different from the source directory's parent. See example below.
@kommen
kommen / pre-archive-action.sh
Created October 24, 2011 08:10
Pre-Archive action for Xcode 4.2 to auto increment CFBundleVersion
buildPlist="${SRCROOT}/${INFOPLIST_FILE}"
CFBundleVersion=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" $buildPlist)
CFBundleVersion=$(($CFBundleVersion + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $CFBundleVersion" $buildPlist
@kommen
kommen / text
Created November 11, 2011 15:17
EXC_BAD_ACCESS is _class_getName when throwing NSException with ARC enabled
Throwing an exception like this:
@throw [NSException exceptionWithName:@"Exception" reason:@"none" userInfo:nil];
in a method, and trying to catch it in a method up the stack, causes a EXC_BAD_ACCESS in:
#0 0x36221fd0 in _class_getName ()
#1 0x36221fbc in object_getClassName ()
#2 0x362261fe in objc_exception_throw ()
@kommen
kommen / array_test.rb
Created December 1, 2011 11:15
Ruby Array inheritance change
class MyArray < ::Array
end
a = MyArray.new
puts a.class
puts a.reverse.class
/* Source: http://solaimurugan.blogspot.com/2010/10/list-out-all-forien-key-constraints.html */
SELECT tc.constraint_name,
tc.constraint_type,
tc.table_name,
kcu.column_name,
tc.is_deferrable,
tc.initially_deferred,
rc.match_option AS match_type,
@kommen
kommen / 0-readme.md
Created February 28, 2012 21:23 — forked from mickm/0-readme.md
ruby-1.9.3-p125 cumulative performance patch, with Xcode 4.3 command line tools compatible.

Patched ruby 1.9.3-p125 for 30% faster rails boot

What is?

This script installs a patched version of ruby 1.9.3-p125 with patches to make ruby-debug work again (#47) and boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84).

It works with Xcode 4.3 and the clang compiler it ships with its command line tools package.

Huge thanks to funny-falcon for the performance patches.