Skip to content

Instantly share code, notes, and snippets.


Matt Curtis matt-curtis

View GitHub Profile
matt-curtis / SwiftUIKeyboardResizing.swift
Last active Aug 28, 2021
iOS 15 SwiftUI Keyboard Resizing (Bug?) Workaround
View SwiftUIKeyboardResizing.swift
import UIKit
import SwiftUI
class KeyboardViewController: UIInputViewController {
override func viewDidLoad() {
struct ContentView: View {
matt-curtis / AnimatableMemberHaving.swift
Last active Aug 22, 2021
AnimatableMemberHaving: A protocol that enables types whose members are made up of Animatable or VectorArithmetic-conforming properties to become Animatable themselves by specifying those members
View AnimatableMemberHaving.swift
import SwiftUI
/// A protocol that enables types whose members are made up of `Animatable` or `VectorArithmetic`-conforming properties
/// to become `Animatable` themselves by specifying those members.
/// Here's an example of how to use this protocol:
/// ```
/// struct CornerRadii: AnimatableMemberHaving {
matt-curtis /
Last active Dec 22, 2020
CALayer.shadowPath and CALayer.path don't overshoot when spring animated.

Playground demonstrating CALayer.shadowPath's failure to overshoot when spring animated.

matt-curtis / LocalServer.swift
Created Mar 18, 2020
Really simple example showing how to create a basic local HTTP server in Swift
View LocalServer.swift
import Foundation
import Cocoa
private enum Constants {
static let crlf: Character = "\r\n"
View SubstringFontReporting.js
let sketch = require('sketch')
let settingsAttribute = getSettingsAttributeForKey_Value(kLowerCaseType, kLowerCaseSmallCapsSelector)
function applySubstringFontModification() {
let document = sketch.getSelectedDocument()
let textLayer = document.selectedLayers.layers[0]
matt-curtis / example.js
Created Jan 27, 2019
Applying attributes to a text layer that's being edited in Sketch
View example.js
const DOM = require("sketch/dom");
const textLayer = DOM.getSelectedDocument().pages[0].selectedLayers.layers[0];
const textView = textLayer.sketchObject.editingDelegate().textView();
// [NSTextView selectedRanges] returns an NSArray of NSValues:
const selectedRange = textView.selectedRanges()[0].rangeValue();
matt-curtis / DelegateForwarder.swift
Last active Mar 11, 2022
Delegate Forwarding in Swift. Useful for choosing some methods of a delegate to handle yourself and others to pass to a different delegate. Inspired by WebKit's Objective-C implementation of the same for UIScrollViewDelegate:…
View DelegateForwarder.swift
class DelegateForwarder<T: NSObjectProtocol>: NSObject {
// MARK: - Properties
weak var internalDelegate: T?
weak var externalDelegate: T?
var asConforming: T {
View UnitBezier.swift
// UnitBezier.swift
// Created by Matt Curtis on 12/24/18.
// Copyright © 2018 Matt Curtis. All rights reserved.
import Foundation
// Almost exact translation of WebKit's UnitBezier struct:
matt-curtis / FontSpike.js
Last active Dec 18, 2018 — forked from KevinGutowski/FontSpike.js
Testing to see if I can build an Opentype Panel
View FontSpike.js
const document = require("sketch").getSelectedDocument();
const textLayer = document.selectedLayers.layers[0];
// WORKS (System font has native support for small caps):
const font = NSFont.systemFontOfSize_weight(28, NSFontWeightBold);
matt-curtis / Lenovo G510 High Sierra
Last active Feb 10, 2019
Lenovo G510 High Sierra Notes
View Lenovo G510 High Sierra


  • WIFI
  • Ethernet
  • Display
  • Touchpad
  • USB (2 & 3)
  • HDMI (Video works, haven't bothered to fix audio yet)
  • Sleep
  • Audio (No microphone)