Skip to content

Instantly share code, notes, and snippets.

+ (UIColor *)colorFromString:(NSString *)string
{
if (![string isKindOfClass:[NSString class]] && (string.length != 3 || string.length != 6 || string.length != 8))
return [UIColor USPGrayColour];
if (string.length == 3)
{
NSMutableString *str = [NSMutableString new];
for(int i =0 ;i<[string length]; i++)
{
//
// Created by Liam Nichols on 14/10/2013.
// Copyright (c) 2013 Mubaloo Ltd. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface LNOrderedMutableDictionary : NSMutableDictionary
///If `anObject` is nil, it will not be added to the dictionary.
NSFetchRequest *search = [NSFetchRequest fetchRequestWithEntityName:@"<<ENTITY NAME>>"];
search.resultType = NSDictionaryResultType;
search.returnsDistinctResults = YES;
search.propertiesToFetch = @[ @"<<ID KEY>>" ];
NSArray *results = [managedObjectContext executeFetchRequest:search error:nil];
NSSet *allIDs = [NSSet setWithArray:[results valueForKeyPath:@"<<ID KEY>>"]];
NSMutableAttributedString *string = [[NSMutableAttributedString alloc] init];
//Total Part
[string appendAttributedString:[[NSAttributedString alloc] initWithString:@"Total: " attributes:[self standardAttributes]]];
//Main Price Part
[string appendAttributedString:[[NSAttributedString alloc] initWithString:@"£99.10" attributes:[self boldAttributes]]];
+ (UIImage *)installButtonBackground:(BOOL)fill
{
CGFloat borderWidth = 1.0;
CGFloat cornerRadius = 3.0;
CGSize size = CGSizeMake((cornerRadius * 2) + 1.0, (cornerRadius * 2) + 1.0);
UIColor *buttonColor = [UIColor installButtonColor];
UIGraphicsBeginImageContextWithOptions(size, NO, 0.0);
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake((borderWidth / 2), (borderWidth / 2), size.width - borderWidth, size.height - borderWidth) byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(cornerRadius, cornerRadius)];
Incident Identifier: 2986E199-B268-464A-883E-362B59A00AD0
CrashReporter Key: c68af6ee22388954851f65669288c7fb6e1c03dc
Hardware Model: iPad4,1
OS Version: iPhone OS 7.1.2 (11D257)
Kernel Version: Darwin Kernel Version 14.0.0: Thu May 15 23:17:54 PDT 2014; root:xnu-2423.10.71~1/RELEASE_ARM64_S5L8960X
Date: 2014-10-21 09:58:46 +0100
Time since snapshot: 218 ms
Free pages: 1951
Active pages: 133010
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<string>fb254145378030027</string>
<string>isupr8</string>
<string>fb176151905794941</string>
<string>recipeSearch-iPad</string>
<string>airfile</string>
<string>univision</string>
@liamnichols
liamnichols / SmallCaps.swift
Last active December 29, 2017 18:11
An extension to simplify use of small caps within a UIFont object in Swift.
public extension UIFont {
/// Helper method to create a UIFont with updated attributes applied to the UIFontDescriptor
///
/// - parameter attributes: The new attributes to apply to the fontDescriptor
///
/// - returns: A UIFont object with the new attributes appended to the receivers fontDescriptor
func addingAttributes(_ attributes: [String : Any] = [:]) -> UIFont {
return UIFont(descriptor: fontDescriptor.addingAttributes(attributes), size: pointSize)
import Foundation
import FirebaseRemoteConfig
final class Config {
/// The shared instance of config to use
static let shared: Config = Config()
/// The maximum number of items that are allowed in this mystery app
internal let maxItemCount: Int
@liamnichols
liamnichols / WebImageCache.swift
Created August 8, 2017 10:47
Why use a library when its this easy?
import UIKit
extension URLSessionTask: WebImageOperation { }
protocol WebImageOperation {
func cancel()
}
class WebImageManager {
struct Error: Swift.Error {