Skip to content

Instantly share code, notes, and snippets.

View schpaa's full-sized avatar
🏠
Working from home

Chris Patrick Schreiner schpaa

🏠
Working from home
View GitHub Profile
#########################
# .gitignore file for Xcode4 / OS X Source projects
#
# Version 2.0
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#
# 2013 updates:
# - fixed the broken "save personal Schemes"
#
# NB: if you are storing "built" products, this WILL NOT WORK,
// MyClass.swift
class MyClass {
func doSomething() {
refresh()
}
}
//**
private func refresh() {
extension NSBezierPath {
var CGPath: CGMutablePath! {
get {
if self.elementCount == 0 {
return nil
}
let path = CGPathCreateMutable()
var didClosePath = false
@schpaa
schpaa / gist:d1ad2feddd900ed70c06
Last active February 9, 2016 09:20
Constraints registering in Swift
import Cocoa
struct Constraint {
typealias T = (attribute: CAConstraintAttribute, relativeTo:String, relatedAttribute: CAConstraintAttribute, offset: CGFloat)
let data: T
func create() -> CAConstraint {
let newConstraint: AnyObject! = CAConstraint.constraintWithAttribute(data.attribute, relativeTo: data.relativeTo, attribute: data.relatedAttribute, offset: data.offset)
return newConstraint as CAConstraint
}