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
import Foundation | |
import SourceKittenFramework | |
let source = """ | |
// Diamond operator | |
infix operator <> | |
func <> <A: AnyObject>(f: @escaping (A) -> Void, g: @escaping (A) -> Void) -> (A) -> Void { | |
return { a in | |
f(a) |
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
query.predicate = NSPredicate(format: "kMDItemContentType = 'public.plain-text' AND kMDItemWhereFroms CONTAINS 'redacted'") | |
query.searchScopes = [NSMetadataQueryUserHomeScope] | |
query.sortDescriptors = [NSSortDescriptor(key: "kMDItemFSContentChangeDate", ascending: false)] | |
observer = NotificationCenter.default.addObserver(forName: NSNotification.Name.NSMetadataQueryDidUpdate, object: query, queue: .main) { (note) in | |
// Super dirty hack so we don't get notified twice | |
if let observer = self.observer { | |
NotificationCenter.default.removeObserver(observer) | |
} |
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
// AMQPConnect setups and creates a connection to RabbitMQ | |
func AMQPConnect() (*amqp.Connection, error) { | |
defaultConfig := config.CreateDefaultConfig() | |
url := fmt.Sprintf("amqp://%s:%s@%s:%s/", | |
defaultConfig.QueueUser, | |
defaultConfig.QueuePassword, | |
defaultConfig.QueueHost, | |
defaultConfig.QueuePort, | |
) |
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
{"BuddybuildSampleApp"=> | |
{"Build Phases"=> | |
[{"Sources"=>["AppDelegate.m", "AppViewController.m", "main.m"]}, | |
{"Frameworks"=>["Foundation.framework", "UIKit.framework"]}], | |
"Build Configurations"=> | |
[{"Debug"=> | |
{"Build Settings"=>{}, | |
"Base Configuration"=>"BuddybuildSampleApp-Debug.xcconfig"}}, | |
{"Profile"=> | |
{"Build Settings"=>{}, |
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 Cocoa | |
let source = """ | |
... | |
""" | |
func hasDuplicates(_ line: String) -> Bool { | |
return line.components(separatedBy: " ") |
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
struct File {} | |
struct Folder {} | |
typealias EnvironmentConfig = [String: String] | |
struct Environment { | |
init(config: EnvironmentConfig) {} | |
} | |
enum Artifact { | |
case IPA(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
#if os(iOS) || os(tvOS) | |
import UIKit | |
public typealias Color = UIColor | |
#else | |
import Cocoa | |
public typealias Color = NSColor | |
#endif | |
extension Color { | |
internal convenience init(hex: String) { |
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
#!/usr/bin/env bash | |
git tag buddybuild-$BUDDYBUILD_BUILD_NUMBER | |
git push --tags |
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
# Fail as soon as one of the `xcodebuild` exits with a non-zero exit code | |
set -e | |
# iOS: | |
xcodebuild -workspace 'Demo.xcworkspace' -scheme 'Demo' -configuration 'Debug' -sdk iphonesimulator -destination name='iPhone 6s' build test | bundle exec xcpretty -c --test | |
# macOS: | |
xcodebuild -workspace 'Demo.xcworkspace' -scheme 'RxViewModelTests-macOS' -configuration 'Debug' -sdk macosx -destination arch='x86_64' test | bundle exec xcpretty -c --test | |
# tvOS: |
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 Foundation | |
let userPayload = """ | |
{ | |
"id": 1337, | |
"username": "Palleas" | |
} | |
""".data(using: .utf8)! |