Skip to content

Instantly share code, notes, and snippets.

View jhurliman's full-sized avatar
🐨

John Hurliman jhurliman

🐨
View GitHub Profile
// List all font families and font names in iOS
for (NSString *familyName in UIFont.familyNames) {
NSLog(@"%@", familyName);
for (NSString *fontName in [UIFont fontNamesForFamilyName:familyName]) {
NSLog(@" %@", fontName);
}
}
public synchronized float[] solveWithDeviceMemory() {
// Allocate native (device) memory for the input data
CLBuffer<Float> bufIn = _context.createFloatBuffer(CLMem.Usage.Input, _input.length);
// Allocate native (device) memory for the output data
CLBuffer<Float> bufOut = _context.createFloatBuffer(CLMem.Usage.Output, _input.length);
// Map input/output buffers for implicit copy
Pointer<Float> ptrIn = bufIn.map(_queue, CLMem.MapFlags.Write);
Pointer<Float> ptrOut = bufOut.map(_queue, CLMem.MapFlags.Read);
@jhurliman
jhurliman / mutex.js
Created July 14, 2012 21:17 — forked from elarkin/Mutex.js
A simple mutex library for node.js
var EventEmitter = require('events').EventEmitter;
module.exports = function() {
var queue = new EventEmitter();
var locked = false;
this.lock = function lock(fn) {
if (locked) {
queue.once('ready', function() { lock(fn); });
} else {
@jhurliman
jhurliman / base64.js
Created September 29, 2011 06:39 — forked from Marak/base64.js
An extremely simple implementation of base64 encoding / decoding using node.js Buffers (plus url-safe versions)
/*
* base64.js: An extremely simple implementation of base64 encoding / decoding using node.js Buffers
*
* (C) 2010, Nodejitsu Inc.
* (C) 2011, Cull TV, Inc.
*
*/
var base64 = exports;