Skip to content

Instantly share code, notes, and snippets.

mayoff / minimal-metal.swift
Created Dec 23, 2017
Hello, Triangle! (MetalKit + Swift 4)
View minimal-metal.swift
import Cocoa
import MetalKit
class AppDelegate: NSObject, NSApplicationDelegate, MTKViewDelegate {
weak var window: NSWindow!
weak var metalView: MTKView!
let device = MTLCreateSystemDefaultDevice()!
var commandQueue: MTLCommandQueue!
var pipelineState: MTLRenderPipelineState!
mayoff /
Created Jun 20, 2017 — forked from chockenberry/
A simple shell script to turn the Finders desktop icons on and off
defaults read CreateDesktop > /dev/null 2>&1
if [ "$1" = "off" ]; then
if [ $enabled -eq 1 ]; then
defaults write CreateDesktop false
osascript -e 'tell application "Finder" to quit'
open -a Finder
View NSDateFormatter cheat sheet
a: AM/PM
A: 0~86399999 (Millisecond of Day)
c/cc: 1~7 (Day of Week)
ccc: Sun/Mon/Tue/Wed/Thu/Fri/Sat
cccc: Sunday/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday
d: 1~31 (0 padded Day of Month)
D: 1~366 (0 padded Day of Year)
mayoff / NSBezierPath-CGPath.swift
Last active Mar 19, 2017 — forked from juliensagot/NSBezierPath+cgPath.swift
Convert NSBezierPath to CGPath (Swift 3.0 / Xcode 8b4 syntax)
View NSBezierPath-CGPath.swift
import AppKit
public extension NSBezierPath {
public var CGPath: CGPath {
let path = CGMutablePath()
var points = [CGPoint](repeating: .zero, count: 3)
for i in 0 ..< self.elementCount {
let type = self.element(at: i, associatedPoints: &points)
switch type {
mayoff /
Last active Aug 13, 2016 — forked from orta/
Disclosable Sections in a GH issue
Summary text. Hello World, how is it going?
Another thing. More revealed content.
mayoff / ConstraintCollection.swift
Last active Apr 19, 2016 — forked from jtbandes/ConstraintCollection.swift
Autolayout constraint literals in Swift (updated for Swift 2.2)
View ConstraintCollection.swift
#if os(iOS)
import UIKit
import AppKit
let view = UIView(frame: CGRectMake(0, 0, 400, 300))
view.backgroundColor = UIColor.redColor()
let button = UIButton(type: .Custom)
You can’t perform that action at this time.