- CLI tool for quickly entering all of the products directories of Xcode
- Inquirer.js for swift
This file contains hidden or 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 | |
// somewhere in a different module | |
struct MyArbitraryUncodableStruct { | |
let aBool: Bool | |
let aInt: Int | |
} | |
extension JSONEncoder { | |
private class CustomEncodable: Encodable { |
This file contains hidden or 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
// | |
// JSContext+Completion.swift | |
// BarcelonaJS | |
// | |
// Created by Eric Rabil on 8/12/21. | |
// Copyright © 2021 Eric Rabil. All rights reserved. | |
// | |
// Shamelessly ported from https://github.com/nodejs/node/blob/master/lib/repl.js | |
// |
This file contains hidden or 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
const fs = require("fs"); | |
function toChunk(lines) { | |
return lines.join("\n "); | |
} | |
function arg(key) { | |
const index = process.argv.indexOf(key); | |
if (index === -1) return null; | |
return process.argv[index + 1]; |
This file contains hidden or 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
# Excerpt from https://svn.webkit.org/repository/webkit/trunk/Tools/Scripts/configure-xcode-for-embedded-development | |
#!/usr/bin/env python3 | |
# | |
# Copyright (C) 2014-2020 Apple Inc. All rights reserved. | |
# | |
# Redistribution and use in source and binary forms, with or without | |
# modification, are permitted provided that the following conditions | |
# are met: | |
# |
This file contains hidden or 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 enum PendingPromise<Output, Failure: Error>: Equatable { | |
public static func == (lhs: PendingPromise<Output, Failure>, rhs: PendingPromise<Output, Failure>) -> Bool { | |
switch lhs { | |
case .pending: | |
switch rhs { | |
case .pending: | |
return true | |
default: |
This file contains hidden or 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 SQLite | |
protocol TableActionable { | |
associatedtype SelfType | |
@discardableResult | |
func insert(db: Connection) throws -> SelfType | |
@discardableResult | |
func update(db: Connection) throws -> SelfType |
This file contains hidden or 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
/** | |
Helper function for efficiently initializing a value based on a pointer | |
- Parameter type: the type of value the pointers value will be cast to | |
- Parameter closure: block of code that will handle the pointer | |
- Returns: tuple of (value the pointer was given, return type of closure) | |
*/ | |
func withUnsafeMutablePointer<T, R>(ofType type: T.Type, _ closure: (UnsafeMutablePointer<T>) -> R) -> (T?, R) { | |
let ptr = UnsafeMutablePointer<T>.allocate(capacity: 1) |
This file contains hidden or 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
// | |
// MachClient.swift | |
// | |
// Created by Eric Rabil on 7/7/21. | |
// | |
import Foundation | |
public let kMachIPCGreet: UInt32 = 4 |