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
// This works. | |
kernel vec4 simpleFilter(sampler p) | |
{ | |
vec2 dc = destCoord(); | |
return sample(p, samplerTransform(p, dc)); | |
} | |
// This does not. It produces [0, 0, 0, 255] for the first 255 pixels and then [0, 0, 0, 0] thereafter. | |
kernel vec4 simpleFilter(sampler p) | |
{ |
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
// | |
// CapturedImageSampler.swift | |
// ARKitTest | |
// | |
// Created by Joshua Sullivan on 9/22/17. | |
// Copyright © 2017 Joshua Sullivan. All rights reserved. | |
// | |
import UIKit | |
import ARKit |
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
// | |
// JTSSwiftTweener.swift | |
// JTSSwiftTweener | |
// | |
// Created by Joshua Sullivan on 12/10/16. | |
// Copyright © 2016 Josh Sullivan. All rights reserved. | |
// | |
import UIKit |
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 | |
/// A type that can be initialized from a string value. | |
/// | |
public protocol StringInitable { | |
/// Initialize the object with a string. | |
/// | |
/// - Note: This operation can fail if the string is not valid for this object type. | |
/// | |
init?(_ string: 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
========================= | |
Color Absolute Difference | |
========================= | |
[Availability] | |
iOS: 14 | |
macOS: 11.0 | |
[Categories] | |
Color Adjustment, Video, Interlaced, Non-Square Pixels, Still Image, Built-In |
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
enum NotificationNames: String { | |
case UserDataChanged: "UserDataChangedNotificationName" | |
case ReceivedAlert: "ReceivedAlertNotificationName" | |
case PeanutButterJellyTime: "ItsPeanutButterJellyTimeNotificationName" | |
} |
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 UIKit | |
import NaturalLanguage | |
import PlaygroundSupport | |
//: Your secret API key from `https://dictionaryapi.com` goes here. | |
//: THIS WON'T WORK UNLESS YOU GET A KEY. | |
let thesaurusKey = "" | |
//: The string you want to work on. | |
var testString = "The bright sun set behind the green hills. Thin clouds streaked the red sky." |
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
//: # Setting up Swift 4 KVO | |
import Foundation | |
//: This class has a pair of properties that can be observied by KVO. | |
//: - Note: This class *must* inheret from `NSObject` in order to posess the KVO functionality. | |
class ObservableClass: NSObject { | |
/// An observable string property. Note that it most be annotated with both "@objc" (expose the property to the | |
/// Objective-C runtime) and "dynamic" (enables KVO for the property). | |
@objc dynamic private(set) var stringProperty: String = "Starting 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
let baseString = "/Documents/" | |
let words = ["Alpha", "Beta", "Gamma", "Delta"] | |
var paths : [String] = [] | |
for (var i = 0; i < words.count; ++i) { | |
let word = words[i] | |
paths.append("\(baseString)\(word)") | |
} | |
print(paths) |
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 | |
public struct ObfuscationDecoder { | |
public enum DeobfuscationError: Error { | |
case invalidStringBytes | |
} | |
/// The multi-byte nonce used to encode strings. | |
private static let nonce: [UInt8] = [199, 152, 254, 45, 85, 241, 134, 185, 22, 249, 182, 208, 43, 176, 143, 252] |