This file contains 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/python | |
from Foundation import * | |
form = NSDateFormatter.alloc().init() | |
form.setFormatterBehavior_(1040) | |
form.setDateFormat_("yyyyMMdd'T'HH:mm:ss'Z") | |
form.setTimeZone_(NSTimeZone.timeZoneForSecondsFromGMT_(0)) | |
print "Implied locale is " + NSLocale.currentLocale().localeIdentifier() | |
print form.stringFromDate_(NSDate.date()) | |
This file contains 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/python | |
from Foundation import * | |
form = NSDateFormatter.alloc().init() | |
# Explicit 24 hour time format used to trump any user settings (I think?) | |
form.setDateFormat_("HH:mm:ss") | |
print "Current locale is " + NSLocale.currentLocale().localeIdentifier() |
This file contains 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
echo "from AppKit import NSPasteboard\nNSPasteboard.pasteboardWithName_(\"IDESourceControlCommitMessagePasteboard\").releaseGlobally()" | python |
This file contains 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
echo "from AppKit import NSPasteboard\nprint NSPasteboard.pasteboardWithName_(\"IDESourceControlCommitMessagePasteboard\").stringForType_(\"IDESourceControlCommitMessagePboardType\")" | /usr/bin/python |
This file contains 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
<table class="loginBox withShadow" style="width:95%"><tbody class="loginCredentials"> | |
<tr><td class="sidePadded" style="font-weight:bold; padding-top: 5px;"><p align="left"><font face="verdana,geneva,arial,sans-serif" size="4" color="green"><b>Welcome to Business Online Banking!</b></font></p></td></tr> | |
<tr><td><hr></td></tr> | |
<tr><td class="sidePadded">Company ID</td></tr> | |
<tr><td class="sidePadded"><input type="text" class="loginCredentials required" style="width:90%" id="companyID" name="companyID" size="20" value="" onkeypress="submitOnEnter(event);"> | |
<br><span id="err_companyID"> | |
</span></td></tr> | |
This file contains 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
@implementation NSImage (RSShading) | |
- (NSImage *) tintedImage | |
{ | |
NSImage* newImage = [[[NSImage alloc] initWithSize:[self size]] autorelease]; | |
NSRect imageRect = {NSZeroPoint, [self size]}; | |
NSColor *color = [NSColor blackColor]; | |
[newImage lockFocus]; | |
[[color colorWithAlphaComponent: 0.25] set]; |
This file contains 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) testSimpleHTTPRequest | |
{ | |
RSHTTPRequest* testViaGoogleRequest = [[RSHTTPRequest alloc] initWithURL:[self serverURLForHTTPTestNamed:@"SimpleHTTPRequest"] notifyingDelegate:self]; | |
STAssertNotNil(testViaGoogleRequest, @"Creation of HTTP Request should have succeeded."); | |
[testViaGoogleRequest download]; | |
[self spinRunLoopUntilCompletionOrTimeout]; | |
STAssertTrue([[testViaGoogleRequest responseData] isEqualTo:[@"<hello>" dataUsingEncoding:NSUTF8StringEncoding]], @"Expected <hello> result, got %@.", [testViaGoogleRequest responseData]); | |
[testViaGoogleRequest release]; |
This file contains 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
tell application "System Events" | |
tell application process "BBEdit" | |
tell (pop up button 1 of window 1) | |
-- Click to make the menu appear in the hierarchy | |
click | |
-- Now select the "Go to" item... | |
set goToItem to menu item "Go to…" of menu 1 | |
click goToItem |
This file contains 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
@implementation MSFilmStripPickerScrollView | |
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event | |
{ | |
return YES; | |
} | |
@end |
This file contains 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
@implementation JimPopUpButtonCell | |
- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView | |
{ | |
NSRect rect = [self drawingRectForBounds: cellFrame]; | |
rect.size.width -= 17; // chop off the popup indicator | |
NSSize imageSize = NSMakeSize(12, 12); | |
rect.origin.x += (rect.size.width - imageSize.width) / 2.0; |