Skip to content

Instantly share code, notes, and snippets.

View chbeer's full-sized avatar

Christian Beer chbeer

View GitHub Profile
@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 / 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 / storeWindowImageToFile
Last active December 23, 2015 17:29
Stores a screenshot of a window to disk as PNG
@implementation NSWindow (JSTalk)
- (BOOL) storeWindowImageToFile:(NSString*)fileName
{
CGWindowID windowID = (CGWindowID)[self windowNumber];
CGWindowImageOption imageOptions = kCGWindowImageDefault;
CGWindowListOption singleWindowListOptions = kCGWindowListOptionIncludingWindow;
CGRect imageBounds = CGRectNull;
CGImageRef windowImage = CGWindowListCreateImage(imageBounds, singleWindowListOptions, windowID, imageOptions);
@chbeer
chbeer / AnimateUILabelTextColor
Created October 2, 2013 09:36
How to animate changing the textColor of a UILabel
[UIView transitionWithView:nameLabel
duration:0.25
options:UIViewAnimationOptionTransitionCrossDissolve
animations:^{
[nameLabel setTextColor:textColor];
}
completion:nil];
@chbeer
chbeer / simCap_stopRecordingAndSave.scpt
Created November 7, 2013 11:06
AppleScript that sends keystrokes to SimCap.app to stop a running recording and to save the movie to temp.mov
-- Uses System Events' keystrokes to start a recording in SimCap.app
-- SimCap: http://www.jaml.co.uk/simcap/
tell application "SimCap"
activate
tell application "System Events"
tell process "SimCap"
keystroke "r" using {command down}
delay 1.0
keystroke "s" using {command down}
@chbeer
chbeer / simCap_startRecording.scpt
Created November 7, 2013 11:04
AppleScript that sends keystrokes to SimCap.app to start recording of the iOS Simulator screen
-- Uses System Events' keystrokes to start a recording in SimCap.app
tell application "SimCap"
activate
delay 0.5
tell application "System Events"
tell process "SimCap"
keystroke "r" using {command down}
end tell
@chbeer
chbeer / releaseNotes iVocabulary 3.0.3
Last active December 28, 2015 15:39
Release Notes for iVocabulary 3.0.3 (iOS)
- fixes crash when "buy"-cell is removed more than once
- fixes crash by preventing user from "opening" downloading documents
- fixed crash by disabling add button when in magic pages
- fixes crash in multiple choice training when delaying answers
- fixes crash in language edit controller
- fixes crash when adding training mode
- fixes crash when uploading files
- fixes crash in slideshow when going past first word
- fixes crash in training mode when repeating words
- fixes some other crashes
#pragma mark -
#pragma mark Core Data stack
/**
Returns the managed object context for the application.
If the context doesn't already exist, it is created and bound to the persistent store coordinator for the application.
*/
- (NSManagedObjectContext *)managedObjectContext {
if (managedObjectContext != nil) {
@chbeer
chbeer / MSLogger set Logging.m
Last active April 22, 2020 06:35
Set logging of MS AppCenter
@interface MSLogger ()
+ (void)setCurrentLogLevel:(MSLogLevel)currentLogLevel;
@end
[MSLogger setCurrentLogLevel:MSLogLevelVerbose];
@chbeer
chbeer / ExportOptions.plist
Created September 10, 2020 12:41
Shell script to deploy to AppStoreConnect
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>app-store</string>
<key>teamID</key>
<string>YOUR_TEAM_ID</string>
<key>destination</key>
<string>upload</string>