Skip to content

Instantly share code, notes, and snippets.

View BennettSmith's full-sized avatar
💭
Always learning!

Bennett Smith BennettSmith

💭
Always learning!
  • San Francisco Bay Area, CA
  • 20:05 (UTC -07:00)
View GitHub Profile
@BennettSmith
BennettSmith / ..build-protbuf-2.5.0.md
Last active October 15, 2022 18:41
Script used to build Google Protobuf 2.5.0 for use with Xcode 5 / iOS 7. Builds all supported architectures and produces a universal binary static library.

Google Protobuf 2.5.0 - Mac OS X and iOS Support

The script in this gist will help you buid the Google Protobuf library for use with Mac OS X and iOS. Other methods (such as homebrew or direct compilation) have issues that prevent their use. The libraries built by this script are universal and support all iOS device architectures including the simluator.

Get the Script

The easiest way to use this script is to simply clone the gist onto your

@BennettSmith
BennettSmith / NSObject+DumpClassInfo.h
Created January 14, 2012 22:27
Objective-C class category to print out names of all selectors on a class.
//
// NSObject+DumpClassInfo.h
// DumpSelectors
//
// Created by Bennett Smith on 1/14/12.
// Copyright (c) 2012 iDevelopSoftware, Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
@BennettSmith
BennettSmith / .gitignore
Last active August 18, 2022 12:09
Google Protobuf v2.6.0 Build Script for iOS
protobuf
protobuf-2.6.0
protobuf-2.6.1
protobuf-master
@BennettSmith
BennettSmith / 0001-Add-generic-GCC-support-for-atomic-operations.patch
Created October 23, 2013 01:37
Patches for Google Protobuf 2.5.0 release designed to add support for architectures that used to work in 2.4.1, but broken in 2.5.0. The patch is courtesy of this developer (https://code.google.com/u/110106420545796050291/) who posted it on the Google Protobuf discussion group (https://code.google.com/p/protobuf/issues/detail?id=488) in May, 2013.
From d099ec11fc8c2eb97df2bf2fbb6996066eefca46 Mon Sep 17 00:00:00 2001
From: Stanislav Ochotnicky <sochotnicky@redhat.com>
Date: Thu, 2 May 2013 10:43:47 +0200
Subject: [PATCH] Add generic GCC support for atomic operations
This is useful for architectures where no specialized code has been
written.
---
src/google/protobuf/stubs/atomicops.h | 2 +-
.../stubs/atomicops_internals_generic_gcc.h | 139 +++++++++++++++++++++
@BennettSmith
BennettSmith / rest-web-service-notes.md
Last active January 17, 2018 17:03
REST Web Service Notes
  • Only use a URL to reference a resource. A resource should never be referenced by some other bit of JSON by a simple identifier (id, oid, etc.)
  • Use HAL to express relationships between resources. (http://stateless.co/hal_specification.html)
  • If a resource appears in the _embedded section of a resource must also appear in the _links section of the resource.
  • Items that appear in the _links section of a resource may also appear in the _embedded section of the resource.
  • Use curies to simplifiy link relationship naming in resources.
  • Use URI Templates to express optional parameters (generally query string parameters) for a resource.
  • Define and publish a URI Template parameter table so clients know what the possible "fill-in-the-blank" fields are for URI templates.
@BennettSmith
BennettSmith / derive-username.sh
Created November 11, 2016 20:15
Transform a text string into an sha256 hash and then base64 encode it.
#!/bin/bash
#
# Takes in an e-mail address and answers back with the expected hash used
# for the AWS Cognito username field.
#
args=`getopt e: $*`
if [ $? != 0 ]; then
echo "Usage: ..."
exit 2
@BennettSmith
BennettSmith / .gitignore
Created April 17, 2013 22:39
The .gitignore file I use with Xcode projects.
# Xcode
build/*
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
@BennettSmith
BennettSmith / .gitignore
Last active April 28, 2017 11:21
gtest-1.7.0 build script
gtest
@BennettSmith
BennettSmith / protobuf-2.5.0-apple-ios7.patch
Created December 14, 2013 06:13
Resolve C++ namespace collision when building Google Protobuf 2.5.0 with Xcode 5.0 for iOS 7.0 Apple includes a copy of protobuf as a private framework and if you link a locally built copy into and app that already uses the private framework version it will result in application crashes. Thanks Apple!
diff -rupN protobuf-2.5.0/src/google/protobuf/stubs/common.h protobuf-2.5.0-modified/src/google/protobuf/stubs/common.h
--- protobuf-2.5.0/src/google/protobuf/stubs/common.h 2013-02-26 09:56:38.000000000 -0800
+++ protobuf-2.5.0-modified/src/google/protobuf/stubs/common.h 2013-12-13 22:03:16.000000000 -0800
@@ -82,6 +82,13 @@ inline BOOL GetMessage(
namespace std {}
+// This is to get around a namespace collision between the privately built
+// copy of Google Protobuf and the copy linked into Apple's OpenGL ES
+// support.
@BennettSmith
BennettSmith / UIImage+ParadigmPics.h
Created July 26, 2013 18:05
UIImage class category for ParadigmPics sample application.
#import <UIKit/UIKit.h>
@interface UIImage (ParadigmPics)
+ (void)saveImage:(UIImage*)image withFilename:(NSString *)filename;
+ (UIImage*)loadImageFromFile:(NSString *)filename;
+ (UIImage *)fixOrientationForImage:(UIImage *)aImage;
@end