Skip to content

Instantly share code, notes, and snippets.

View chbeer's full-sized avatar

Christian Beer chbeer

View GitHub Profile
@chbeer
chbeer / other c flags
Last active December 21, 2015 17:18
My current "other c flags" setting for get a good amount of warnings and turn the most important/dangerous warnings into errors.
-Wall
-Wno-deprecated-declarations
-Werror=incompatible-pointer-types
-Werror=arc-retain-cycles
-Werror=implicit-function-declaration
-Werror=return-type
-Werror=format
-Werror=mismatched-parameter-types
-Werror=tautological-constant-out-of-range-compare
@chbeer
chbeer / gist:5802954
Created June 18, 2013 05:58
Short example how I setup the synchronisation for iCloud sync with TICoreDataSync
- (void) registerSyncManager
{
if (self.applicationSyncManager) return;
TICDSLogVerbosity logVerbosity = [[NSUserDefaults standardUserDefaults] integerForKey:kIVTICDSLogVerbosity];
[TICDSLog setVerbosity:logVerbosity];
if (![self hasLocalDatabase]) {
@chbeer
chbeer / NSDate ISO methods
Created June 10, 2013 09:33
Methods to create and parse ISO date strings without NSDateFormatter.
NSDate *CBCBDateFromISOString(NSString *iso)
{
struct tm tm;
time_t t;
if (iso.length == 10) {
strptime([iso cStringUsingEncoding:NSUTF8StringEncoding], "%Y-%m-%d", &tm);
tm.tm_isdst = -1;
tm.tm_sec = 0;
@chbeer
chbeer / gist:1612240
Created January 14, 2012 17:46
iPad logs when it doesn't finish deleting iCloud account.
========================
ASL is here to serve you
>
Jan 14 17:31:24 unknown configd[45] <Error>: WiFi:[348251484.774721]: bootstrap_look_up of WiFiManager server failed
Jan 14 17:31:24 unknown kernel[0] <Debug>: AppleBCMWLANChipManager::withBus(): BCM4329 revision B1
Jan 14 17:31:24 unknown kernel[0] <Debug>: AppleMultitouchZ2SPI: downloaded 47160 bytes of firmware data ("0x0146.bin") in 154ms.
Jan 14 17:31:24 unknown kernel[0] <Debug>: AppleBCMWLANChipManagerSdio4329::downloadFirmware(): start
Jan 14 17:31:24 unknown kernel[0] <Debug>: Loading syscfg.
@chbeer
chbeer / gist:1385714
Created November 22, 2011 13:56
Small Apple Script that creates a mail with UUID of device
do shell script "system_profiler SPHardwareDataType | grep 'Hardware UUID:'"
set uuid to text ((offset of ":" in result) + 2) thru -1 of result
tell application "Mail"
set theNewMessage to make new outgoing message with properties {subject:"Mac App Beta - My UUID", content:uuid, visible:true}
tell theNewMessage
make new to recipient at end of to recipients with properties {address:"mail@test.com"}
end tell
end tell
@chbeer
chbeer / gist:1312967
Created October 25, 2011 14:42
performFetchAndUpdateTableView: that performs a fetch request on NSFetchedResultsController and updates table view
// ONLY WORKS WITH ONE SECTION!!
- (BOOL) performFetchAndUpdateTableView:(NSError **)error
{
NSArray *objectsBefore = [self.fetchedResultsController.fetchedObjects retain];
BOOL result = [self.fetchedResultsController performFetch:error];
if (result) {
NSArray *objectsAfter = self.fetchedResultsController.fetchedObjects;