Skip to content

Instantly share code, notes, and snippets.

View mindbrix's full-sized avatar

Nigel Timothy Barber mindbrix

View GitHub Profile
@mindbrix
mindbrix / picasaUtilities.php
Created November 28, 2010 12:23
A simple utility to extract an array of full size Picasa web image URLs for a given user and album. Written for http://vectoria.co.uk/gallery/
<?php
// http://code.google.com/p/picasaphp/
//
require_once("Picasa.php" );
/* Return an array of full size Picasa web image URLs
*
* Written for http://vectoria.co.uk/gallery/
@mindbrix
mindbrix / UIView+getUIColor.h
Created March 30, 2011 15:57
A UIImage category to read a single pixel as a UIColor
//
// UIView+getUIColor.h
// PRL_iPad_Catalogue
//
// Created by Nigel Barber on 30/03/2011.
// Copyright 2011 Mindbrix. All rights reserved.
//
@interface UIImage (getUIColor)
@mindbrix
mindbrix / UIView+Geometry.h
Created June 3, 2013 16:24
UIView+Geometry
//
// UIView+Geometry.h
// Swipe To Scrub
//
// Created by Nigel Barber on 29/10/2012.
// Copyright (c) 2012 Mindbrix. All rights reserved.
//
#import <UIKit/UIKit.h>
@mindbrix
mindbrix / NTBProxyImageView.h
Created June 21, 2013 17:07
NTBProxyImageView
//
// NTBProxyImageView.h
// Vectoria Squared
//
// Created by Nigel Barber on 22/04/2013.
// Copyright (c) 2013 Nigel Barber. All rights reserved.
//
#import <UIKit/UIKit.h>
@mindbrix
mindbrix / drawTimecodeUsingGCD.m
Created July 8, 2013 11:48
How to draw rapidly refreshed string labels performantly using GCD.
-(void)drawTimecodeUsingGCD
{
if( dispatch_semaphore_wait( _timecodeSemaphore, DISPATCH_TIME_NOW ) != 0 )
{
return;
}
dispatch_async( _timecodeQueue, ^()
{
float fontSize = ceilf( self.scrubberSize * 0.425f );
@mindbrix
mindbrix / UILabel+MultiLineSupport.h
Created October 23, 2013 13:59
Support for creating a multi-line UILabel from NSAttributedStrings
//
// UILabel+MultiLineSupport.h
// giffgaffIOS
//
// Created by Nigel Barber on 23/10/2013.
// Copyright (c) 2013 confidence. All rights reserved.
//
#import <UIKit/UIKit.h>
//
// UILabel+MultiLineSupport.h
// giffgaffIOS
//
// Created by Nigel Barber on 23/10/2013.
// Copyright (c) 2013 confidence. All rights reserved.
//
#import <UIKit/UIKit.h>
//
// NTBFifoOperationQueue.h
// Timeline
//
// Created by Nigel Barber on 19/11/2013.
// Copyright (c) 2013 Nigel Barber. All rights reserved.
//
#import <Foundation/Foundation.h>
@mindbrix
mindbrix / Matrix.hpp
Created April 6, 2014 18:22
Matrix and Vector C++ classes extended from the ones in this book: http://shop.oreilly.com/product/9780596804831.do
#pragma once
#include "Vector.hpp"
template <typename T>
struct Matrix2 {
Matrix2()
{
x.x = 1; x.y = 0;
y.x = 0; y.y = 1;
}
@mindbrix
mindbrix / gist:710707d3dec311196e5e
Last active August 29, 2015 14:03
Unicode char to NSString
NSString *hexString = @"1F0A7";
unsigned int character;
NSScanner* scanner = [NSScanner scannerWithString:hexString ];
[ scanner scanHexInt:&character ];
UTF32Char inputChar = NSSwapHostIntToLittle(character); // swap to little-endian if necessary
NSString *str = [[NSString alloc] initWithBytes:&inputChar length:4 encoding:NSUTF32LittleEndianStringEncoding];