This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// AGBinaryDataStream.h | |
// AraeliumFoundation | |
// | |
// Created by Seth Willits on 11/15/09. | |
// Copyright 2009 Araelium Group. All rights reserved. | |
// | |
#import <Cocoa/Cocoa.h> | |
#import "AGBinaryStream.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import CoreGraphics | |
/* | |
Usage: | |
Interpolate(.linear).between(x, and: y, progress: progress) // progress is 0 to 1 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# Keith Bauer made this. | |
require 'find' | |
require 'getoptlong' | |
EXTS = Regexp.compile('^.*\.(' + %w[ | |
h hh hpp H | |
c cc cpp cxx C | |
m mm M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct DataStructure { | |
var x: Int | |
var s: String | |
} | |
// Create a "convenience" namespace to separate properties and functions which we | |
// don't want confused with being actual properties of the original structure. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
<style> | |
body { | |
margin: 0; | |
padding: 0; | |
background: white; | |
font-family: 'Helvetica Neue', Helvetica, Arial, Geneva, sans-serif; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation NSWindow (Additions) | |
typedef NS_ENUM(NSUInteger, AGEndTextEditingOption) { | |
AGEndTextEditingAndClearFirstResponder = 0, | |
AGEndTextEditingAndMaintainFirstResponder, | |
}; | |
//! Returns YES if the field editor voluntarily gives up first responder status. Also returns YES if nothing was being edited. | |
//! If the maintain option is used, the first responder is set to the field editor's text field. | |
//! Returns NO if the field didn't want to give up first responder, probably because of some validation issue. In this case, use ag_forcefullyEndTextEditing if needed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Using https://gist.github.com/swillits/93206997e7d1bff4d08e24e23173820e | |
extension AVPlayer { | |
private struct AssociatedKeys { | |
static var statusChangeHandler = "ag_statusChangeHandler" | |
static var statusReceptionist = "ag_statusReceptionist" | |
} | |
var statusChangeHandler: ((AVPlayerStatus) -> ())? { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Receptionist: NSObject { | |
typealias KVOReceptionistBlock = (Info) -> () | |
private var opQueue: OperationQueue? = nil | |
private var kvoHandler: KVOReceptionistBlock! = nil | |
private var kvoObject: NSObject! = nil | |
private var kvoKeyPath: String! = nil | |
private var kvoContext: Int? = nil | |
private var activeLock = QueueLock() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ------------------------------------- | |
// Want to do this | |
// ------------------------------------- | |
var selectable = false { | |
willSet { | |
if !newValue { | |
selected = false | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Keycode { | |
// Layout-independent Keys | |
// eg.These key codes are always the same key on all layouts. | |
static let returnKey : UInt16 = 0x24 | |
static let enter : UInt16 = 0x4C | |
static let tab : UInt16 = 0x30 | |
static let space : UInt16 = 0x31 | |
static let delete : UInt16 = 0x33 | |
static let escape : UInt16 = 0x35 |