Skip to content

Instantly share code, notes, and snippets.

View Palleas's full-sized avatar

Romain Pouclet Palleas

View GitHub Profile
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)
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)
}
// 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,
)
{"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"=>{},
//: Playground - noun: a place where people can play
import Cocoa
let source = """
...
"""
func hasDuplicates(_ line: String) -> Bool {
return line.components(separatedBy: " ")
struct File {}
struct Folder {}
typealias EnvironmentConfig = [String: String]
struct Environment {
init(config: EnvironmentConfig) {}
}
enum Artifact {
case IPA(File)
#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) {
#!/usr/bin/env bash
git tag buddybuild-$BUDDYBUILD_BUILD_NUMBER
git push --tags
# 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:
//: Playground - noun: a place where people can play
import Foundation
let userPayload = """
{
"id": 1337,
"username": "Palleas"
}
""".data(using: .utf8)!