This file contains hidden or 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
// | |
// GenericTableManager.swift | |
// Copyright © 2020 andreashanft.de. All rights reserved. | |
// | |
import Foundation | |
import UIKit | |
import Reusable | |
/* |
This file contains hidden or 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
class CaptureClass { | |
var action: ((Int) -> Void)? | |
init() { | |
// Passing a method reference to an escaping closure implicitly captures self | |
// and in this case causes a refernce cycle! | |
addAction(takesInt) | |
// To avoid memory leak: |
This file contains hidden or 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
//: A UIKit based Playground for presenting user interface | |
/// Add an event publisher to UIControls | |
/// From: https://forums.swift.org/t/a-uicontrol-event-publisher-example/26215/19 | |
extension UIControl { | |
private class EventObserver { | |
let control: UIControl | |
let event: UIControl.Event |
This file contains hidden or 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
raspi-config | |
sudo apt-get update | |
sudo apt-get upgrade | |
sudo rpi-update | |
(reboot) | |
sudo apt-get install vlc | |
sudo apt-get install iceweasel | |
sudo apt-get install xfce4 |
This file contains hidden or 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
### Section for configuring miscelleneous Subversion options. | |
[miscellany] | |
### Set global-ignores to a set of whitespace-delimited globs | |
### which Subversion will ignore in its 'status' output, and | |
### while importing or adding files and directories. | |
### '*' matches leading dots, e.g. '*.rej' matches '.foo.rej'. | |
global-ignores = *.o *.lo *.la *.al .libs *.so *.so.[0-9]* *.a *.pyc *.pyo *.rej *~ #*# .#* .*.swp .DS_Store Pods Podfile.lock xcuserdata *.xcuserdatad |
This file contains hidden or 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
post_install do | installer | | |
prefix_header = installer.config.project_pods_root + 'Pods-prefix.pch' | |
text = prefix_header.read + <<-EOS | |
#if DEBUG | |
#define NSLog(fmt, ...) NSLog((@"[DEBUG] %s [Line %d] " fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__) | |
#else | |
#define NSLog(fmt, ...) (void)0 | |
#endif | |
EOS | |
prefix_header.open('w') { |file| file.write(text) } |
This file contains hidden or 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
static int depth = 0; | |
+ (void) traverseAndPrintDataStructure:(id)object | |
{ | |
NSMutableString* indent = [NSMutableString string]; | |
for (int i = 0; i < depth; i++) | |
{ | |
[indent appendString:@"\t"]; | |
} | |
This file contains hidden or 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
NSTask* task = [[NSTask alloc] init]; | |
{ | |
[task setStandardOutput:[NSPipe pipe]]; | |
[task setStandardError:[NSPipe pipe]]; | |
[task setLaunchPath:...]; | |
[task setArguments:...]; | |
[task setTerminationHandler:^(NSTask* task) | |
{ | |
if ([task terminationStatus] == 0) | |
{ |