Skip to content

Instantly share code, notes, and snippets.

View traviskirton's full-sized avatar

Travis traviskirton

View GitHub Profile
@traviskirton
traviskirton / C4WorkSpace.m
Last active December 26, 2015 23:09
Clever, clever trick.
#import "C4WorkSpace.h"
#import "ClassA.h"
#import "ClassB.h"
@implementation C4WorkSpace
-(void)setup {
ClassA *objA = [ClassA new];
ClassB *objB = [ClassB new];
@traviskirton
traviskirton / C4WorkSpace.m
Last active December 26, 2015 23:09
Clever, clever trick. Part 2. This implementation improves on https://gist.github.com/C4Framework/7228100 by providing a basic copy method in the primary class (i.e. `ClassA`) for copying its own methods. The `+initialize` in `ClassB` first copies the `copyProtocolMethods` method, then runs it on itself. Thus, each class that copies from `ClassA…
#import "C4WorkSpace.h"
#import "ClassA.h"
#import "ClassB.h"
@implementation C4WorkSpace
-(void)setup {
ClassA *objA = [ClassA new];
ClassB *objB = [ClassB new];
@traviskirton
traviskirton / gist:698883c87bd234fa8403
Created December 2, 2014 23:06
Random IsometricLines - New C4 Logo
//
// ViewController.swift
// C4Swift
//
// Created by travis on 2014-10-28.
// Copyright (c) 2014 C4. All rights reserved.
//
import UIKit
import C4iOS
@traviskirton
traviskirton / ViewController
Created June 25, 2015 01:27
C4Image create with CGImageRef
import UIKit
import C4UI
import C4Core
import C4Animation
public struct PixelData {
var a:UInt8
var r:UInt8
var g:UInt8
var b:UInt8
@traviskirton
traviskirton / ViewController
Created June 30, 2015 13:52
Flip view, container v. noContainer
//
// ViewController.swift
// C4Swift
//
// Created by travis on 2014-10-28.
// Copyright (c) 2014 C4. All rights reserved.
//
import UIKit
import C4UI
@traviskirton
traviskirton / CentralViewController.swift
Created July 9, 2015 17:32
M-O: Central Manager Subscribing to Characteristics on Peripheral Devices
//
// ViewController.swift
// Central
//
// Created by travis on 2015-07-08.
// Copyright (c) 2015 C4. All rights reserved.
//
import Cocoa
import CoreBluetooth
@traviskirton
traviskirton / InfiniteScrollView.swift
Last active August 16, 2020 20:15
InfiniteScrollView using C4
// Copyright © 2016 C4
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions: The above copyright
// notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
@traviskirton
traviskirton / AppDelegate.swift
Last active August 29, 2015 14:25
PeripheralSocketManager class, from the HouseKeeping chapter
//
// AppDelegate.swift
// MOPeripheral
//
// Created by travis on 2015-07-17.
// Copyright (c) 2015 C4. All rights reserved.
//
import UIKit
@traviskirton
traviskirton / ViewController.swift
Created July 24, 2015 19:54
Getting used to the do try catch system in Swift2.0
//
// ViewController.swift
// test
//
// Created by travis on 2015-07-24.
// Copyright © 2015 C4. All rights reserved.
//
import Cocoa
@traviskirton
traviskirton / C4PointExtension.swift
Created July 24, 2015 22:53
Serialize extension for C4Point
extension C4Point {
func serialize() -> NSData {
var point = C4Point(x,y)
let data = NSData(bytes: &point, length: sizeof(C4Point))
return data
}
public init(_ data: NSData) {
let point = UnsafePointer<C4Point>(data.bytes).memory