Skip to content

Instantly share code, notes, and snippets.

View phughes's full-sized avatar

Patrick Hughes phughes

View GitHub Profile
@phughes
phughes / NSDateFormatter+fbsThreadSafeFormatter.h
Created September 9, 2013 21:32
A thread safe way to parse dates with arbitrary formats. NSDateFormatter is not thread safe. This method keeps a collection of formatters, one per thread per format, and creates/returns them in a thread safe manner. Caching formatter objects results in a significant speed improvement. On the simulator (2.4Ghz i5) we see the following numbers: Fo…
//
// NSDateFormatter+fbsThreadSafeFormatter.h
// NSDateAdditions
//
// Created by Patrick Hughes on 3/3/13.
// Copyright (c) 2013 Patrick Hughes. All rights reserved.
//
#import <Foundation/Foundation.h>
@phughes
phughes / image.py
Last active March 5, 2023 21:58
An Xcode precompilation script to turn your images into auto-completeable, type-checkable symbols.
import os.path as path
import string
import argparse
import glob
import re
def basename(filename):
base = filename
if filename.find('@2x') > 0:
base = filename[:filename.find('@2x')]