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
// ==UserScript== | |
// @name Chroma-Hash password visualization | |
// @namespace http://purl.org/net/mkhl | |
// @description Add Chroma-Hash visualization to all password field inputs. Compatible with Greasemonkey and GreaseKit. | |
// @include * | |
// ==/UserScript== | |
// Many thanks to Henrik Nyh and Mattt Thompson for doing all the hard work! | |
(function() { |
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
// Cocoa UI Unit Testing | |
// Source: http://eschatologist.net/blog/?p=205 | |
@interface MyTestCase : SenTestCase | |
@end | |
@implementation MyTestCase | |
/*! Tells whether the control sends the action to the target. */ | |
- (BOOL)checkControl:(NSControl *)control |
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
PROJECT=foo | |
SOURCES=bar.c baz.c | |
LIBRARY=nope | |
INCPATHS=../some_other_project/ | |
LIBPATHS=../yet_another_project/ | |
LDFLAGS=-ldosomething | |
CFLAGS=-c -Wall | |
CC=gcc | |
# ------------ MAGIC BEGINS HERE ------------- |
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
// Replace triple dots with proper ellipses. | |
// Source: http://www.mikeabdullah.net/ellipses_and_sheepkit.html | |
- (BOOL)textView:(EweEyeTextView *)textView | |
shouldChangeTextInRange:(NSRange)range | |
replacementText:(NSString *)text | |
{ | |
BOOL result = YES; | |
if ([text hasSuffix:@"."]) // Accounts for somehow entering ".." | |
{ |
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 -wKU -rubygems | |
# http://www.stompy.org/2008/08/14/xcode-and-git-another-build-script/ | |
# I saw the script from the above URL and thought it was unnecessarily complicated. | |
# So I uncomplicated it. | |
require 'osx/plist' | |
File.open(File.join(ENV['BUILT_PRODUCTS_DIR'], ENV['INFOPLIST_PATH']), 'r+') do |io| | |
plist, format = OSX::PropertyList.load(io, true) |
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=":" |
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 -wKU -rubygems | |
require "nokogiri" | |
def to_action(text) | |
doc = Nokogiri::XML(text) | |
doc.xpath('/action-recipes/snippet').each do |node| | |
txt = node.at('text') | |
txt.remove | |
snippet = txt.content |
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
// Source: http://www.dribin.org/dave/blog/archives/2008/09/24/proper_kvo_usage/ | |
// Define a static object; strings are easily readable, which is a plus | |
static NSString *const kOpeningBalanceChanged = @"openingBalance changed"; | |
// Use it for the `context` parameter when adding KVO | |
[object addObserver:observer | |
forKeyPath:@"openingBalance" | |
options:options | |
context:kOpeningBalanceChanged]; |
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
// Define a protocol MyProtocol that inherits from the NSObject protocol. | |
// This way, calls to NSObject messages (release, retain, …) don’t warn. | |
// Source: http://www.mobileorchard.com/idprotocol-retainrelease-and-protocol-inheritance/ | |
@protocol MyProtocol<NSObject> | |
- (void)someMessage; | |
@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
// Getting Loaded | |
// Source: http://googlemac.blogspot.com/2006/11/getting-loaded.html | |
@implementation Foo (FooBarAdditions) | |
... | |
@end | |
@interface Foo (FooBarAdditionsPrivateMethods) | |
+ (void) initializeBar; | |
@end |