Skip to content

Instantly share code, notes, and snippets.

View phatblat's full-sized avatar

Ben Chatelain phatblat

View GitHub Profile
@phatblat
phatblat / crashlytics.rb
Created June 13, 2014 20:12
CrashlyticsFramework pod run script that works with local (:path) installs by dynamically detecting where the pod was installed
#!/usr/bin/env ruby
# crashlytics.rb
#
# Created by Ben Chatelain on 5/13/14.
# Alternate values make much of this script testable from outside Xcode
if ARGV.length > 0
args = ARGV.join(" ")
else
@phatblat
phatblat / sparse_checkout.sh
Last active August 29, 2015 14:06
Git sparse checkout
tmpdir=/tmp/phatblat-images
subdir=images/
remote_git=git://github.com/phatblat/phatblat.github.io.git
remote_https=https://github.com/phatblat/phatblat.github.io.git
mkdir $tmpdir
cd $tmpdir
git init
git remote add -f origin $remote_git || \
git remote set-url origin $remote_https && \
@phatblat
phatblat / gist:e354c5c7b21a9f557f88
Created October 24, 2014 16:42
iOS Model Identifier
size_t size;
sysctlbyname("hw.machine", NULL, &size, NULL, 0);
char *machine = calloc(1, size);
if (machine) {
sysctlbyname("hw.machine", machine, &size, NULL, 0);
NSLog(@"modelIdentifier: %@", @(machine));
free(machine);
}
@phatblat
phatblat / libgit2certs.m
Created November 11, 2014 17:39
An example of configuring libgit2 on iOS to use the root CA cert for GitHub
#import <git2/common.h>
NSString *const CACertificateFile_DigiCert = @"DigiCert High Assurance EV Root CA.pem";
NSString *const certFilePath = [[NSBundle mainBundle].bundlePath stringByAppendingPathComponent:CACertificateFile_DigiCert];
NSLog(@"Loading certificate: %@", certFilePath);
const char *file = certFilePath.UTF8String;
const char *path = NULL;
int returnValue = git_libgit2_opts(GIT_OPT_SET_SSL_CERT_LOCATIONS, file, path);
PhaseScriptExecution Run\ Script /Users/phatblat/Library/Developer/Xcode/DerivedData/ObjectiveGitFramework-drtqacfhlqybdcdpqayztrrwneun/Build/Intermediates/ObjectiveGitFramework.build/Debug/libgit2.build/Script-D0A330F116027F2300A616FA.sh
cd /Users/phatblat/dev/libgit2/objective-git
export ACTION=build
export ALTERNATE_GROUP=staff
export ALTERNATE_MODE=u+w,go-w,a+rX
export ALTERNATE_OWNER=phatblat
export ALWAYS_SEARCH_USER_PATHS=NO
export ALWAYS_USE_SEPARATE_HEADERMAPS=YES
export APPLE_INTERNAL_DEVELOPER_DIR=/AppleInternal/Developer
export APPLE_INTERNAL_DIR=/AppleInternal
@phatblat
phatblat / gist:1185469
Created September 1, 2011 04:41 — forked from shazron/gist:1167362
auto-ingest
import java.io.*;
import java.net.URL;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import javax.net.ssl.HttpsURLConnection;
public class Autoingestion
{

Welcome to Drift!

Drift is an always-already versioned, cloud-backed text editor. You can use it to take notes, and save them in the GitHub cloud.

Your gists are always saved locally, and any changes you make will get pushed to GitHub's servers.

To name a gist, touch its name in the toolbar.

You can use the share button at the top-right to copy a link to one of your gists, or view it on the web in Safari.

/*
* Bookmarklet for viewing source in iPad Safari
*/
javascript:(function(){
var w = window.open('about:blank'),
s = w.document;
s.write('<!DOCTYPE html><html><head><title>Source of ' + location.href + '</title><meta name="viewport" content="width=device-width" /></head><body></body></html>');
s.close();
@phatblat
phatblat / UIDeviceHardware.h
Created September 27, 2012 02:43 — forked from Jaybles/UIDeviceHardware.h
UIDeviceHardware - Determine iOS device being used
//
// UIDeviceHardware.h
//
// Used to determine EXACT version of device software is running on.
#import <Foundation/Foundation.h>
@interface UIDeviceHardware : NSObject
- (NSString *) platform;