Skip to content

Instantly share code, notes, and snippets.

Chris Ballinger chrisballinger

Block or report user

Report or block chrisballinger

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
IanKeen / Redraw.swift
Created Nov 5, 2019
PropertyWrapper to automatically redraw UIViews when a value changes
View Redraw.swift
struct Redraw<Value> {
var wrappedValue: Value
init(wrappedValue: Value) {
self.wrappedValue = wrappedValue
static subscript<Instance: UIView>(
_enclosingInstance instance: Instance,
View AnyCodable.swift
public struct AnyCodable: Codable {
public let value: Any?
public init(_ value: Any?) {
self.value = value
public init(from decoder: Decoder) throws {
let container = try decoder.singleValueContainer()
View Podfile
# When using RN in combination with Cocoapods, a lot of
# things are broken. These are the fixes we had to append
# to our Podfile when upgrading to ReactNative@0.55.3.
# WARNING: Check those line numbers when you're on a different version!
def change_lines_in_file(file_path, &change)
print "Fixing #{file_path}...\n"
contents = []
View appnap.swift
import AppKit
func shell(_ launchPath: String, _ arguments: [String]) -> String {
let task = Process()
task.launchPath = launchPath
task.arguments = arguments
let pipe = Pipe()
task.standardOutput = pipe
rnapier / json.swift
Last active Nov 8, 2019
Generic JSON Decodable
View json.swift
import Foundation
enum JSON: Codable, CustomStringConvertible {
var description: String {
switch self {
case .string(let string): return "\"\(string)\""
case .number(let double):
if let int = Int(exactly: double) {
return "\(int)"
smileyborg / SelfSizingTableHeaderAndTableFooterViews.swift
Last active Sep 19, 2019
How to manually self-size UITableView tableHeaderView/tableFooterView in iOS 11
View SelfSizingTableHeaderAndTableFooterViews.swift
// For the best results, your tableHeaderView/tableFooterView should be a UITableViewHeaderFooterView with your content inside the contentView.
let tableHeaderView = UITableViewHeaderFooterView()
let fittingSize = CGSize(width: tableView.bounds.width - (tableView.safeAreaInsets.left + tableView.safeAreaInsets.right), height: 0)
let size = tableHeaderView.systemLayoutSizeFitting(fittingSize, withHorizontalFittingPriority: .required, verticalFittingPriority: .fittingSizeLevel)
tableHeaderView.frame = CGRect(origin: .zero, size: size)
tableView.tableHeaderView = tableHeaderView
// When you set this view to the tableHeaderView/tableFooterView on the table view, the table view will preserve the existing size of its frame.
// If you need to change the size, remove the tableHeaderView/tableFooterView, set a new frame on it, then re-set it on the table view again.
steipete / PSPDFGenerics.h
Last active Mar 15, 2019
Override copy and mutableCopy on Objective-C collection classes to pass along both the collection type and the generic info. This is a header-only "library". MIT licensed. Craving for more? foreach: even more: - ships in https://p…
View PSPDFGenerics.h
// PSPDFGenerics.h
// PSPDFFoundation
// PSPDFKit is the leading cross-platform solution for integrating PDFs into your apps:
// Try it today using our free PDF Viewer app:
// This file is MIT licensed.
ageis /
Last active Nov 10, 2019
Options for hardening systemd service units

security and hardening options for systemd service units

A common and reliable pattern in service unit files is thus:

steipete / gist:d9b44d8e9f341e81414e86d7ff8fb62d
Last active Nov 12, 2019
Using iOS 13.2 devices with Xcode 11.1 (instead of Xcode 11.2) (also, Xcode 10.3)
View gist:d9b44d8e9f341e81414e86d7ff8fb62d
// The trick is to link the DeviceSupport folder from the beta to the stable version.
// sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :)
// Support iOS 13.2 devices (Xcode 11.2) with Xcode 11.1:
sudo ln -s /Applications/ /Applications/
// Xcode 10.3 to Xcode 11
sudo ln -s /Applications/ /Applications/
// Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions
View Crosstool NG 1.22, Raspberry PI
$ git clone -b 1.22
$ cd crosstool-ng
$ ./bootstrap
$ ./configure --prefix=/usr/local
$ make
$ sudo make install
$ cd ..
$ mkdir ctng
$ cd rpi1
$ ct-ng menuconfig
You can’t perform that action at this time.