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
- (NSString *)stringForDate:(NSDate *)date | |
withLocale:(NSLocale *)locale | |
timeZone:(NSTimeZone *)timeZone | |
dateFormat:(NSString *)dateFormat | |
dateStyle:(NSDateFormatterStyle)style | |
{ | |
if (dateFormat == nil) | |
dateFormat = @"yyyy-MM-dd HH:mm:ss Z"; | |
if (locale == nil) | |
locale = [NSLocale currentLocale]; |
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
macappstores://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/redeemLandingPage?code=XXXXXXXXX | |
(source: Brett Terpstra, https://gist.github.com/2081239) |
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
- (NSString *)relativeDateStringFromDate:(NSDate *)date | |
{ | |
NSDate *now = [NSDate date]; | |
if ([now laterDate:date] == date) | |
return nil; //dates in the future are not supported | |
NSInteger years = [now yearsSinceDate:date]; | |
NSInteger months = [now monthsSinceDate:date]; | |
NSInteger weeks = [now weeksSinceDate:date]; | |
NSInteger days = [now daysSinceDate:date]; | |
NSInteger hours = [now hoursSinceDate: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
Monitoring your memory usage with Activity Monitor is pretty unreliable. First, which memory field are you watching (Virtual Private Memory, Real Private Memory, Real Shared Memory, or Real Memory)? | |
Second, when your code makes an allocation request, that typically goes, directly or indirectly, to the malloc routines. The malloc routines try to satisfy your request from the memory that it already has. If it can't then it requests more from the system. When you free memory, it goes back to malloc. Malloc does not necessarily return it to the system. It may keep it to more quickly satisfy future requests. So, you may not see your process's memory usage go down, at least not all the way, even if your program is releasing everything it allocated. | |
The proper way to check that your program is managing memory correctly is to use Instruments with the Leaks and Allocations tools. | |
(source: http://stackoverflow.com/questions/10218314/cocoa-memory-issue-memory-doesnt-get-reclaimed-when-objects-are-removed-from-a ) |
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)delete | |
{ | |
void (^myBlock)() = ^{/*some block action*/}; | |
NSBeginCriticalAlertSheet(NSLocalizedString(@"ReallyDeleteWarning", nil), | |
NSLocalizedString(@"Delete", nil), | |
NSLocalizedString(@"Cancel", nil), nil, self.window, self, nil, | |
@selector(deleteAlertWindow:didDismissWithCode:context:), | |
(__bridge_retained void *)([myBlock copy]), | |
NSLocalizedString(@"ReallyDeleteWarningMsg", nil)); |
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
flickery Demo | |
http://eternalstorms.at/flickery/flickery.zip | |
ScreenFloat Demo | |
http://eternalstorms.at/ScreenFloat/ScreenFloat.zip | |
Yoink Demo | |
http://eternalstorms.at/yoink/Yoink.zip | |
App Store Links: |
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
Mac App Store: | |
macappstore://itunes.apple.com/app/idMACAPPSTOREAPPID | |
iOS App Store: | |
itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=IOSAPPSTOREAPPID |
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)hideFullscreenButtonOfWindow:(NSWindow *)aWindow | |
{ | |
NSButton *fsButton = [aWindow standardWindowButton:NSWindowFullScreenButton]; | |
[fsButton setHidden:YES]; | |
fsButton.alphaValue = 0.0; | |
[fsButton setEnabled:NO]; | |
fsButton.image = nil; | |
fsButton.alternateImage = nil; | |
} |
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
Die Uhr | |
Ich trage, wo ich gehe, stets eine Uhr bei mir, wieviel es geschlagen habe, genau seh ich an ihr. Es ist ein großer Meister, der künstlich ihr Werk gefügt, wenn gleich ihr Lauf nicht immer dem törichten Wunsche genügt. Ich wollte, sie wäre rascher gegangen an manchem Tag, ich wollte, sie hätte manchmal verzögert den raschen Schlag. In meinem Leiden und Freuden, im Sturm und in der Ruh, was immer geschah im Leben, sie pochte den Takt dazu. Sie schlug am Sarge des Vaters, sie schlug an des Freundes Bahr! Sie schlug am Morgen der Liebe, sie schlug am Traualtar. Sie schlug an der Wiege des Kindes, sie schlägt, will's Gott, noch oft, wenn bessere Tage kommen, wie meine Seel es hofft. Und ward sie auch manchmal träger, und drohte zu stocken ihr Lauf, so zog der Meister immer großmütig sie wieder auf. Doch stände sie einmal stille, dann wär's um sie geschehn, kein anderer, als der sie fügte, bringt die zerstörte zum Geh'n. Dann müßt ich zum Meister wandern, der wohnt am Ende wohl weit, wohl draußen, |
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
NSSupportsAutomaticGraphicsSwitching = YES (in Info.plist) |
OlderNewer