Skip to content

Instantly share code, notes, and snippets.

Rob Mayoff mayoff

Block or report user

Report or block mayoff

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
@mayoff
mayoff / minimal-metal.swift
Created Dec 23, 2017
Hello, Triangle! (MetalKit + Swift 4)
View minimal-metal.swift
import Cocoa
import MetalKit
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate, MTKViewDelegate {
weak var window: NSWindow!
weak var metalView: MTKView!
let device = MTLCreateSystemDefaultDevice()!
var commandQueue: MTLCommandQueue!
var pipelineState: MTLRenderPipelineState!
@mayoff
mayoff / finder_icons.sh
Created Jun 20, 2017 — forked from chockenberry/finder_icons.sh
A simple shell script to turn the Finders desktop icons on and off
View finder_icons.sh
#!/bin/sh
defaults read com.apple.finder CreateDesktop > /dev/null 2>&1
enabled=$?
if [ "$1" = "off" ]; then
if [ $enabled -eq 1 ]; then
defaults write com.apple.finder 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
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
mayoff / Issue.md
Last active Aug 13, 2016 — forked from orta/Issue.md
Disclosable Sections in a GH issue
View Issue.md
Summary text. Hello World, how is it going?
Another thing. More revealed content.
@mayoff
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
#else
import AppKit
#endif
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.