Something to fetch
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
If you construct a Swift NSObject subclass with a designated initialiser that only has default parameters, for example; | |
{code:swift} | |
class SomeClass: NSObject { | |
private let foo: Int! | |
init(foo bar: Int = 1) { | |
foo = bar | |
} | |
} |
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
// | |
// CwlRandom+NWA.swift | |
// Butterfly | |
// | |
// Created by Bruno Scheele on 10/07/16. | |
// Copyright © 2016 Noodlewerk Apps V.o.f. All rights reserved. | |
// | |
import Foundation |
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
// The easiest pattern. Just use a `static let`, which gets lazy loaded as a bonus. | |
class Singleton { | |
static let sharedInstance = Singleton() | |
func helloWorld() { | |
print("Hello world") | |
} | |
} | |
Singleton.sharedInstance.helloWorld() // prints "Hello world" |
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
//: Playground - noun: a place where people can play | |
import UIKit | |
protocol Money: CustomStringConvertible { | |
var amount: Double { get } | |
var inGold: Double { get } | |
var symbol: String { get } | |
} |
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
/** A person, with a name. */ | |
@interface Person : NSObject | |
/** Creates a new person with the specified name. */ | |
+ (id)newWithString:(NSString *)name; | |
@end |
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
# Upload with HockeyApp | |
open -a HockeyApp "${ARCHIVE_PATH}" | |
# Auto increment CFBundleVersion | |
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}") | |
buildNumber=$(($buildNumber + 1)) | |
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/${INFOPLIST_FILE}" |
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
// For the directory 'en' find all m4v files and combine add the audio of other languages. | |
find * -name "*.m4v" -exec ffmpeg -i "{}" -i "../de/{}" -i "../fr/{}" -i "../nl/{}" -i "../sp/{}" -map 0 -map 1:a:0 -map 2:a:0 -map 3:a:0 -map 4:a:0 -metadata:s:a:0 language=eng -metadata:s:a:1 language=deu -metadata:s:a:2 language=fra -metadata:s:a:3 language=nld -metadata:s:a:4 language=spa -y "../all/{}" \; | |
// Make all audio of every m4v file mono and lower the sound bit rate to 48k. Change the size. | |
find * -name "*.mp4" -exec ffmpeg -i "{}" -map 0 -ac 1 -ab 48k -s 504x896 -y "../all_lq/{}" \; | |
// Use the following syntax to parse other extensions. Taken from: http://stackoverflow.com/a/8107281/571461 | |
find -L . -type f -name "*.mp4" -exec sh -c 'ffmpeg -i ${1%.mp4}.wav' _ {} \; |
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
_chimpKit = [[ChimpKit alloc] initWithDelegate:self andApiKey:@"APIKEY"]; | |
NSDictionary *mergeVars = @{ | |
@"FNAME" : @"Code name", | |
@"EMAIL" : @"codename@email.com", | |
@"BIRTHDAY" : @"dd-MM-yyyy", | |
@"GENDER" : @"male", // or 'female' | |
@"LANGUAGE" : NSLocalizedString(@"Key", nil), // localized string | |
@"MC_LANGUAGE" : NSLocalizedString(@"HFXMailchimpLanguageString", nil), // localized string | |
@"SUBSCRIBE" : @"yes", // or 'no' | |
}; |
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
// DebugView: Adds a Quartz border around the view. | |
// shortcut: debugView | |
// scope: Function or Method | |
// Don't forget to #import <QuartzCore/QuartzCore.h>. | |
<#view#>.layer.borderColor = [UIColor cyanColor].CGColor; | |
<#view#>.layer.borderWidth = 1.f; | |
// Localized String: Makes it easier to start localizing from the get-go. |