Skip to content

Instantly share code, notes, and snippets.

toco / Mail alias recovery
Created Oct 1, 2015
Apple Script to migrate old e-mail aliases (which where lost when upgrading to El Capitan) to Mail 9.0.
View Mail alias recovery
tell application "System Events"
set plistFile to property list file "~/Library/Mail/V2/MailData/Accounts.plist"
set plistRoot to contents of plistFile
tell plistRoot to set accountsPlist to value of property list item "MailAccounts"
end tell
tell application "Mail"
toco / gist:9dddb3035430f6c12b73
Created Feb 17, 2015
let Keynote reevaluate all cells of the next slide
View gist:9dddb3035430f6c12b73
tell application "Keynote"
set allSlides to slides of front document
set currentslide to current slide of front document
set nextSlideNumber to (slide number of currentslide) + 1
if nextSlideNumber < (count of allSlides) then
set nextSlide to item nextSlideNumber of allSlides
repeat with aCell in cells in every table of nextSlide
set tmpFormula to formula of aCell
if tmpFormula is not missing value then
toco / VLC_add_folders_in_Documents.diff
Last active Aug 29, 2015
Add support for directories when scanning documents directory.
View VLC_add_folders_in_Documents.diff
diff --git a/Sources/VLCAppDelegate.m b/Sources/VLCAppDelegate.m
index ef5f12f..e80422b 100644
--- a/Sources/VLCAppDelegate.m
+++ b/Sources/VLCAppDelegate.m
@@ -278,16 +278,28 @@
- (void)updateMediaList
NSString *directoryPath = [self directoryPath];
- NSArray *foundFiles = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:directoryPath error:nil];
- NSMutableArray *filePaths = [NSMutableArray arrayWithCapacity:[foundFiles count]];
toco / TOCMotionEffectsEngine.m
Created Sep 27, 2013
Enable UIMotionEffects when AirPlay mirroring is turned on.
View TOCMotionEffectsEngine.m
// Copyright (c) 2013 Tobias Conradi
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
toco / App Delegate
Last active Dec 19, 2015
Category for to create URLs using the BezahlCode library.
View App Delegate
- (BOOL)application:(NSApplication *)sender openFile:(NSString *)filename {
NSData *fileData = [NSData dataWithContentsOfFile:filename];
DTAData *aDTAData = [DTAParser parseData:fileData];
for (NSURL *aUrl in [aDTAData bezahlCodeURLs]) {
[[NSWorkspace sharedWorkspace] openURL:aUrl];
BOOL success = aDTAData!=nil;
if (!success) {
// handle error
toco / gist:5055909
Created Feb 28, 2013
Partial mocking with OCMockito, OCHamcrest sut calls showAlert (verified in debugger) but the test fails
View gist:5055909
- (void)testShowsAlertViewWhenOpenInSafariFails
sut = spy(sut);
// given
[sut view];
UIApplication *application = mock([UIApplication class]);
sut.application = application;
// when