Skip to content

Instantly share code, notes, and snippets.

View brianmichel's full-sized avatar
🎯
Focusing

Brian Michel brianmichel

🎯
Focusing
View GitHub Profile

Adventures in making a Cocoapods Plugin

So, there I was, trying to comprehend why I couldn’t grab some dependencies that have been resolved by including a specific Cocoapod only to realize that it’s a problem with not being able to clone in a specific way. An hour or two later I figured out a work around by replacing the specific source url with an https url. instead of using the specified git url. Meaning I would transform something like this

git@cool-git-server.com:Organization/repo.git

into something like this

Preparing
- Running pre install hooks
- cocoapods-github_token_http_rewriter from `/Users/brianmichel/Development/Tumblr/cocoapods-github_token_http_rewriter/lib/cocoapods_plugin.rb`
Updating local specs repositories
Updating spec repo `master`
$ /usr/local/bin/git pull --ff-only
Updating 1efd512..92ee543
Fast-forward
# Top level module for source url rewriter
module SourceURLRewriter
Pod::HooksManager.register('source_rewriter', :pre_install) do |context|
require 'cocoapods'
require 'pod/src/configuration'
require 'pod/src/rewriter'
Pod::UI.warn('Just about to set some stuff up')
configuration = SourceURLRewriter::Configuration.new(context)
SourceURLRewriter::Rewriter.new(context, configuration).rewrite!
@brianmichel
brianmichel / gist:9ec8b8cf31432e387b6c
Created March 28, 2015 17:21
Broken code in optimized build.
func logURLPath(urlString: NSString) {
urlString.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding).map { urlString in
NSURL(string: urlString).map { path in
println("Opening URL: \(path)")
}
}
}
char -[_PFManagedObjectReferenceQueue _queueForDealloc:](void * self, void * _cmd, void * arg2) {
ebx = *_OBJC_IVAR_$__PFManagedObjectReferenceQueue._spinLock;
ebx = ebx + self;
OSSpinLockLock(ebx);
edx = self;
eax = *_OBJC_IVAR_$__PFManagedObjectReferenceQueue._context;
var_10 = 0x1;
if (*(edx + eax) != 0x0) {
eax = edx->_queue;
if (eax == 0x0) {
@brianmichel
brianmichel / leaks-run-sizer.rb
Created December 22, 2014 19:32
Calculates the full size of the accumulated leaks for a given run.
# Expects a full output from the leaks instrument.
# This script will skip the first line and calculate
# the total size of your leak session
path = ARGV[0]
lines = File.open(File.expand_path(path)).read
total_size_in_bytes = 0
@brianmichel
brianmichel / gist:2370c22e0885e2ae8691
Created December 2, 2014 18:26
Crazy WebKit Output
__XPC_DYLD_FRAMEWORK_PATH=/Users/brian/Library/Developer/Xcode/DerivedData/Tumblr-agosignkmwzrqrdtfvnhsucfynjz/Build/Products/Debug
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.2YSgPURACv/Listeners
DYLD_PRINT_LIBRARIES=true
Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.VS6AAu6qEF/Render
__XPC_DYLD_LIBRARY_PATH=/Users/brian/Library/Developer/Xcode/DerivedData/Tumblr-agosignkmwzrqrdtfvnhsucfynjz/Build/Products/Debug
__XCODE_BUILT_PRODUCTS_DIR_PATHS=/Users/brian/Library/Developer/Xcode/DerivedData/Tumblr-agosignkmwzrqrdtfvnhsucfynjz/Build/Products/Debug
DYLD_FRAMEWORK_PATH=/Users/brian/Library/Developer/Xcode/DerivedData/Tumblr-agosignkmwzrqrdtfvnhsucfynjz/Build/Products/Debug
XPC_FLAGS=0x0
DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/usr/lib/libBacktraceRecording.dylib:/Applications/Xcode.app/Contents/PlugIns/DebuggerUI.ideplugin/Contents/Resources/libViewDebuggerSupport.dylib
SHELL=/bin/zsh
<= 10 photos XOR
==1 video XOR
==1 link XOR
==1 text XOR
@brianmichel
brianmichel / install-charles-cert.sh
Created August 6, 2014 15:20
Patched Charles simulator certificate installer script
#/bin/bash
install() {
if [ -f "$SQLITEDBPATH" ]; then
cp -n "$SQLITEDBPATH" "$SQLITEDBPATH.charlesbackup"
sqlite3 "$SQLITEDBPATH" <<EOF
INSERT INTO "tsettings" VALUES(X'189B6E28D1635F3A8325E1E002180DBA2C02C241',X'3123302106035504030C1A436861726C65732050726F78792053534C2050726F7879696E6731243022060355040B0C1B687474703A2F2F636861726C657370726F78792E636F6D2F73736C3111300F060355040A0C08584B3732204C74643111300F06035504070C084175636B6C616E643111300F06035504080C084175636B6C616E64310B3009060355040613024E5A',X'3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D225554462D38223F3E0A3C21444F435459504520706C697374205055424C494320222D2F2F4170706C652F2F44544420504C49535420312E302F2F454E222022687474703A2F2F7777772E6170706C652E636F6D2F445444732F50726F70657274794C6973742D312E302E647464223E0A3C706C6973742076657273696F6E3D22312E30223E0A3C61727261792F3E0A3C2F706C6973743E0A',X'3082045E30820346A003020102020101300D06092A864886F70D01010505003081913123302106035504030C1A436861726C65732050726F78792053534C2050726F7879696E67312430
class var sharedManager: BSMBrightnessManager {
struct Singleton {
static let instance = BSMBrightnessManager()
}
return Singleton.instance
}