Skip to content

Instantly share code, notes, and snippets.

ooopscc / PSPDFGenerics.h
Created Mar 15, 2019 — forked from steipete/PSPDFGenerics.h
Override copy and mutableCopy on Objective-C collection classes to pass along both the collection type and the generic info. This is a header-only "library". MIT licensed. Craving for more? foreach: even more: - ships in https://p…
View PSPDFGenerics.h
// PSPDFGenerics.h
// PSPDFFoundation
// PSPDFKit is the leading cross-platform solution for integrating PDFs into your apps:
// Try it today using our free PDF Viewer app:
// This file is MIT licensed.
View ThreadSafeMutableArray.h
// Created on 2019/1/25.
#import <Foundation/Foundation.h>
@interface ThreadSafeMutableArray<ObjectType> : NSObject <NSFastEnumeration, NSCopying>
ooopscc / PSPDFThreadSafeMutableDictionary.m
Created Jan 25, 2019 — forked from steipete/PSPDFThreadSafeMutableDictionary.m
Simple implementation of a thread safe mutable dictionary. In most cases, you want NSCache instead, but it can be useful in situations where you want to manually control what is evicted from the cache in low memory situations.**Warning:** I only use this for setting/getting keys. Enumeration is not thread safe here and will still throw exception…
View PSPDFThreadSafeMutableDictionary.m
// PSPDFThreadSafeMutableDictionary.m
// Copyright (c) 2013 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
// 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 without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
View ArrayHelpers.swift
extension Array {
func first() -> Element? {
if isEmpty {
return nil
return self[0]
func last() -> Element? {
ooopscc / CCDeepCopy.h
Created Dec 8, 2014
Deep Copy Categories for NSArray & NSDictionary
View CCDeepCopy.h
// CCDeepCopy.h
// Created by ooops on 12/8/14.
// Copyright (c) 2014 All rights reserved.
#import <Foundation/Foundation.h>
#pragma mark - NSArray
You can’t perform that action at this time.