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 |
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
NSString *const kKeychainErrorDomain = @"kKeychainErrorDomain" | |
NSString * ServiceName = @"My Service"; | |
+ (NSError *) errorWithStatus:(OSStatus) status { | |
if (errSecSuccess == status) return nil; | |
#if __has_feature(objc_arc) | |
NSString *message = (__bridge_transfer NSString *)SecCopyErrorMessageString(status, NULL); | |
#else | |
NSString *message = [(id) SecCopyErrorMessageString(status, NULL) autorelease]; |
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/Foundation.h> | |
static const uint8_t huffman_table[] = | |
{ | |
0xFF, 0xC4, 0x01, 0xA2, 0x00, 0x00, 0x01, 0x05, 0x01, 0x01, 0x01, 0x01, | |
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, | |
0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x01, 0x00, 0x03, | |
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, | |
0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, | |
0x0A, 0x0B, 0x10, 0x00, 0x02, 0x01, 0x03, 0x03, 0x02, 0x04, 0x03, 0x05, |
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
let startLocations: [NSNumber] = [ 0.0, 0.05, 0.25, 0.3] | |
let endLocations: [NSNumber] = [ 0.7, 0.75, 0.95, 1] | |
gradient.startPoint = CGPoint(x: -0, y: 0.5) | |
gradient.endPoint = CGPoint(x: 1, y: 0.5) | |
gradient.colors = [ UIColor.white.cgColor, UIColor.tetraDarkBlue.cgColor, UIColor.tetraDarkBlue.cgColor, UIColor.white.cgColor ] | |
gradient.locations = startLocations | |
layer.insertSublayer(gradient, at: 0) |
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
-(void) addAppAsLoginItem { | |
if ([self wasAppAddedAsLoginItem]) return; | |
NSString * appPath = [[NSBundle mainBundle] bundlePath]; | |
// This will retrieve the path for the application | |
// For example, /Applications/test.app | |
CFURLRef url = (__bridge CFURLRef)[NSURL fileURLWithPath:appPath]; | |
// Create a reference to the shared file list. |
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
// $base-font-size: 16px; // not sure this ever did anything | |
$base-line-height: 1.5; | |
// this value may vary for each font | |
// unitless value relative to 1em | |
$cap-height: 0.68; | |
@mixin baseline($font-size, $scale: 2) { |
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
$base-font-size: 16px; | |
$base-line-height: 1.5; | |
// this value may vary for each font | |
// unitless value relative to 1em | |
$cap-height: 0.68; | |
@mixin baseline($font-size, $scale: 2) { |
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
// | |
// AppDelegate.m | |
// MetalComputeOSX | |
// | |
#import "AppDelegate.h" | |
@import Metal; | |
#define IMAGE_SIZE 128 |
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
// Function to update image buffer in NV12 format with BGRA pixel buffer | |
// Assumptions: | |
// bgra buffer is 32bpp | |
// bgra buffer width and height equal to imageBuffer | |
// bgra buffer stride is equal to imageBuffer width | |
int UpdateSampleBufferWithBGRAPixels(CVImageBufferRef imageBuffer, void *bgraPixels) { | |
const OSType pixelFormat = CVPixelBufferGetPixelFormatType(imageBuffer); | |
assert(pixelFormat == kCVPixelFormatType_420YpCbCr8BiPlanarFullRange || pixelFormat == kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange); | |
const size_t width = CVPixelBufferGetWidth(imageBuffer); |
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
/* CGSPrivate.h -- Header file for undocumented CoreGraphics stuff. */ | |
/* This file is a relicensed portion of DesktopManager and was originally released under | |
* the terms of the GNU General Public Licence. Original licence text follows the new terms. | |
* The contents of this file has been re-released by the original author under the following terms: | |
* | |
* Copyright (C) 2003, 2004, 2013 Richard J Wareham <[email protected]> | |
* | |
* 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 |
NewerOlder