Skip to content

Instantly share code, notes, and snippets.

View tritchey's full-sized avatar

Tim Ritchey tritchey

View GitHub Profile
func captureSession(_ session: RoomCaptureSession, didChange room: CapturedRoom) {
for surface in room.walls {
if let frame = self.arView.session.currentFrame {
var image: CGImage? = nil
VTCreateCGImageFromCVPixelBuffer(frame.capturedImage, options: nil, imageOut: &image)
let wallTransform = surface.transform
let cameraTransform = frame.camera.transform
let intrinsics = frame.camera.intrinsics
let projectionMatrix = frame.camera.projectionMatrix
class ISO8601OptionalFractionalSecondsDateFormatter: ISO8601DateFormatter {
static let withoutFractionalSeconds = ISO8601DateFormatter()
func setup() {
formatOptions = [.withInternetDateTime, .withFractionalSeconds]
}
override init() {
super.init()
#!/bin/sh
kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
@tritchey
tritchey / vigilCoreDatabase.m
Created July 27, 2014 20:37
Background merge
- (void)backgroundContextDidSaveNotification:(NSNotification*)notification
{
for (NSManagedObject *object in notification.userInfo[NSDeletedObjectsKey]) {
NSLog(@"deleted: %@", object.entity.name);
}
// the background moc saved - merge changes
NSManagedObjectContext *context = [self managedObjectContext];
void (^mergeChanges) (void) = ^ {
[context mergeChangesFromContextDidSaveNotification:notification];
};
@tritchey
tritchey / button.js
Created February 8, 2012 15:42
rendering children
ScaleUI.ButtonView = SC.View.extend(SC.ActionSupport, {
useStaticLayout: true,
classNames: ['sc-button'],
displayProperties: ['label'],
label: null,
isEnabled: true,
isEnabledBindingDefault: SC.Binding.oneWay(),
@tritchey
tritchey / select.css
Created November 30, 2011 23:09
select styling
select {
-khtml-appearance: none;
display: block;
height: 30px;
width: 68px;
font-size: 15px;
text-align: top;
line-height: 12px;
padding: 0 10px;
color: #aaa;
@tritchey
tritchey / output.log
Created November 2, 2011 01:07
sc-build output
INFO ~ Starting build process...
INFO ~ Loaded project at: /builds/automated/8576/src/client/scale_ui
INFO ~ Building targets: /scale_ui,/sproutcore/jquery,/sproutcore/runtime,/sproutcore/handlebars,/sproutcore/yuireset,/sproutcore/core_foundation,/sproutcore/routing,/sproutcore/datetime/core,/sproutcore/datetime,/sproutcore/datetime/localized,/sproutcore/ajax,/sproutcore/foundation,/sproutcore/desktop,/sproutcore/datastore,/sproutcore/statechart,/sproutcore,/scale_model,/sproutcore/empty_theme,/sproutcore/ace
INFO ~ Building languages: en
INFO ~ Building manifest for: /scale_ui:en
INFO ~ Building manifest for: /sproutcore/jquery:en
INFO ~ Building manifest for: /sproutcore/runtime:en
INFO ~ Building manifest for: /sproutcore/handlebars:en
INFO ~ Building manifest for: /sproutcore/yuireset:en
INFO ~ Building manifest for: /sproutcore/core_foundation:en
@tritchey
tritchey / tasks.js
Created July 22, 2011 17:40
filtering
ScaleUI.taskTagController = SC.ArrayController.create(
/** @scope ScaleUI.taskTagController.prototype */ {
queuedTasks: function() {
var content = this.get('content');
if(!SC.none(content)) {
return content.filterProperty('state', TaskState.QUEUED);
}
}.property('@each.state').cacheable(),
@tritchey
tritchey / field.handlebars
Created July 6, 2011 13:52
template with validator
<span class="label">{{loc "_Port"}}</span>
{{view PortField valueBinding="ScaleUI.alertSMTPController.port"}}
@tritchey
tritchey / mainpage.js
Created June 23, 2011 02:16
multicolumn template
ListviewTest.testController = SC.ArrayController.create({
content: [ { 'name': 'Item 1', 'description': 'This is item 1' },
{ 'name': 'Item 2', 'description': 'This is item 2' } ],
});
ListviewTest.mainPage = SC.Page.design({
// The main pane is made visible on screen as soon as your app is loaded.
// Add childViews to this pane for views to display immediately on page