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
@available(iOS 3.0, *) | |
public enum Code : Int { | |
public typealias _ErrorType = SKError | |
case unknown = 0 | |
case clientInvalid = 1 // client is not allowed to issue the request, etc. | |
case paymentCancelled = 2 // user cancelled the request, etc. |
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
async function xxx() { | |
for (page of window.__pg) { | |
const blob = await fetch(window.__info.servers[window.__info.img.server] + window.__info.img.url + page.u).then(res => res.blob()); | |
const blob_url = URL.createObjectURL(blob); | |
const a = document.createElement("a"); | |
a.href = blob_url; | |
a.download = window.__info.current.number + '_' + page.u; | |
document.body.appendChild(a); | |
a.click(); | |
document.body.removeChild(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
static func _compile(data: Data, configuration: MLModelConfiguration = .init()) async throws -> MLModel { | |
let tmp = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString) | |
try data.write(to: tmp, options: .atomic) | |
let url = try await MLModel.compileModel(at: tmp) | |
try FileManager.default.removeItem(at: tmp) | |
let model = try MLModel(contentsOf: url, configuration: configuration) | |
try FileManager.default.removeItem(at: url) | |
return model | |
} |
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
extension MTLCaptureManager { | |
@discardableResult | |
func capture<T>(with commandQueue: MTLCommandQueue, _ action: () throws -> T) throws -> T { | |
let scope = self.makeCaptureScope(commandQueue: commandQueue) | |
let descriptor = MTLCaptureDescriptor() | |
descriptor.captureObject = scope | |
try self.startCapture(with: descriptor) | |
scope.begin(); defer { scope.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
import sys | |
import os | |
import clang.cindex | |
shaders_file = sys.argv[1] | |
assert(shaders_file.endswith(“.metal”)) | |
ast_file = shaders_file.rstrip(“.metal”) + “.ast” | |
os.system(f”xcrun metal -emit-ast {shaders_file}“) | |
xcode_path = os.popen(“xcode-select -p”).read().rstrip() |
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
abacus | |
accordion | |
acorn | |
acrobat | |
adult | |
adult_cat | |
agriculture | |
aircraft | |
airplane | |
airport |
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
swiftformat \ | |
--self insert \ | |
--wrapcollections before-first \ | |
--wraparguments before-first \ | |
--wrapparameters before-first \ | |
--header strip \ | |
--ifdef no-indent \ | |
--enable wrapSwitchCases \ | |
--enable organizeDeclarations \ | |
--swiftversion 5.3 . |
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
private final class AppInfo { | |
private struct Keys { | |
static let lastKnownAppVersion = "app_data.last_known_app_version" | |
static let appWasInBackground = "app_data.app_was_in_background" | |
static let appWasTerminated = "app_data.app_was_terminated" | |
} | |
struct State { | |
let appVersionIsChanged: Bool | |
let appWasInBackground: Bool |
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 EnumSet<T: RawRepresentable & CaseIterable>: OptionSet where T.RawValue == Int { | |
let rawValue: T.RawValue | |
init(rawValue: T.RawValue) { | |
self.rawValue = rawValue | |
} | |
init(_ value: T) { | |
self.rawValue = 1 << value.rawValue | |
} |
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
--self insert | |
--wrapcollections after-first | |
--wraparguments after-first | |
--wrapparameters after-first | |
--header strip | |
--enable wrapSwitchCases | |
--enable organizeDeclarations |
NewerOlder