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
function clone(obj) { | |
if (!obj || typeof obj !== 'object') { | |
return obj; | |
} | |
if (obj instanceof Date) { | |
return new Date(obj.getTime()); | |
} | |
var result, | |
propertyIndex, |
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
NSPopUpButton *popup = NSToolbarSizeModeSmall == [toolbar sizeMode] | |
? [[[NSPopUpButton alloc] initWithFrame:NSMakeRect(0.0, 0.0, 40.0, 24.0)] autorelease] | |
: [[[NSPopUpButton alloc] initWithFrame:NSMakeRect(0.0, 0.0, 48.0, 32.0)] autorelease]; | |
[[popup cell] setControlSize:NSSmallControlSize]; | |
[popup setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; | |
destinationPopup = [popup retain]; | |
[result setView:popup]; [popup release]; |
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
syntax: glob | |
\.DS_Store | |
Icon? | |
*~.nib | |
build | |
\.metadata | |
bin | |
*.pbxuser | |
*.mode1v3 | |
dist |
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
var bustedInput = document.getElementsByTagName('zinput')[0]; | |
var fixedInput = document.createElement('input'); | |
for (var attrIndex = 0; attrIndex < bustedInput.attributes.length; attrIndex++) { | |
var attrName = bustedInput.attributes[attrIndex].nodeName; | |
var attrValue = bustedInput.getAttribute(attrName); | |
fixedInput.setAttribute(attrName, attrValue); | |
} | |
bustedInput.parentElement.appendChild(fixedInput); | |
bustedInput.parentElement.removeChild(bustedInput); |
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
wolf-mbp:~ wolf$ macirb | |
irb(main):001:0> a = ['a','b'] | |
=> ["a", "b"] | |
irb(main):002:0> a.each {|x| puts x} | |
a | |
b | |
=> ["a", "b"] | |
irb(main):003:0> s = NSSet.setWithArray(a) | |
=> #<NSCFSet:0x20024e260> | |
irb(main):004:0> s.each {|x| puts x} |
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/local/bin/macirb --simple-prompt | |
>> d1 = NSMutableDictionary.dictionary | |
=> {} | |
>> d2 = {} | |
=> {} | |
>> d1.class.ancestors | |
=> [NSMutableDictionary, NSDictionary, Enumerable, NSObject, Kernel] | |
>> d2.class.ancestors | |
=> [NSMutableDictionary, NSDictionary, Enumerable, NSObject, Kernel] |
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
RewriteEngine On | |
#RewriteLogLevel 2 | |
#RewriteLog /var/log/apache2/rewrite.log | |
#RewriteCond %{REQUEST_METHOD} ^TRACE | |
RewriteCond %{QUERY_STRING} ^(.+)$ | |
RewriteRule ^(.*)$ /displayPage.php?path=$1&%1 [L,PT] | |
RewriteRule ^(.*)$ /displayPage.php?path=$1 [L,PT] |
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
NSAppleEventDescriptor *target = [NSAppleEventDescriptor descriptorWithDescriptorType:typeApplicationBundleID | |
data:[@"com.apple.Finder" dataUsingEncoding:NSUTF8StringEncoding]]; | |
NSAppleEventDescriptor *quitEvent = [NSAppleEventDescriptor appleEventWithEventClass:kCoreEventClass | |
eventID:kAEQuitApplication | |
targetDescriptor:target | |
returnID:kAutoGenerateReturnID | |
transactionID:kAnyTransactionID]; | |
OSStatus err = AESendMessage([quitEvent aeDesc], // theAppleEvent | |
NULL, // reply | |
kAENoReply, // sendMode |
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
// Store Twitter Replies in Yojimbo.jstalk | |
// | |
// Usage: select a subscription in NetNewsWire that contains a bunch of twitter replies you'd like to archive | |
// (often lazytweet replies). This script will gather all *unread* "headlines" (sadly I can't seem to just | |
// access selected headlines) and push them into one new Yojimbo note (all hyperlinked and stuff). | |
var nnw = [SBApplication application:"NetNewsWire"], | |
headlines = [[nnw selectedSubscription] headlines], | |
headlineIndex = 0, | |
headlineCount = [headlines count], |
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
- (void)windowDidLoad { | |
var window = [self window], | |
contentView = [window contentView], | |
contextViewSize = [contentView bounds].size, | |
scrollSize = CGSizeMake(contextViewSize.width - (20*2), contextViewSize.height - 70), | |
scrollFrame = CGRectMake(20, 20, scrollSize.width, scrollSize.height), | |
tableFrame = CGRectMake(0, 0, scrollSize.width, scrollSize.height), | |
tableView = [[CPTableView alloc] initWithFrame:tableFrame], | |
nameColumn = [[CPTableColumn alloc] initWithIdentifier:'name'], | |
yearColumn = [[CPTableColumn alloc] initWithIdentifier:'year'], |