Skip to content

Instantly share code, notes, and snippets.

View tylerhall's full-sized avatar

Tyler Hall tylerhall

View GitHub Profile
@tylerhall
tylerhall / cron.php
Created February 13, 2013 05:30
Get ready for WWDC.
<?PHP
$html = file_get_contents('https://developer.apple.com/wwdc/');
if($html === false)
{
send_script_failure();
exit;
}
preg_match_all('/2012/', $html, $mentions2012);
@tylerhall
tylerhall / gist:3504380
Created August 28, 2012 21:09
Remove the fucking ads within my Bank of America online statement.
Add these rules:
.cardlytics-transaction-offer { display:none; }
.cardlytics_reset { display:none; }
to your favorite CSS injection browser extension. I use Stylish (http://userstyles.org/stylish/) for Chrome and Firefox.
@tylerhall
tylerhall / SFBestGuess.h
Created September 25, 2011 19:21
By inspecting the user's address book and finding the most common city, state, and zip code - we can make an educated guess as to the user's location without using CoreLocation.
#import <Foundation/Foundation.h>
#import <AddressBook/AddressBook.h>
@interface SFBestGuess : NSObject {
NSMutableArray *_cities;
NSMutableArray *_states;
NSMutableArray *_zipCodes;
}
@property (nonatomic, retain) NSMutableArray *cities;
@tylerhall
tylerhall / gist:1078783
Created July 12, 2011 19:30
Reposition iOS Simulator Window
#!/bin/sh
osascript -e 'tell app "System Events" to set position of window 1 of process "iOS Simulator" to {-864, 134}'
defaults write com.clickonideas.web.nottingham SUEnableAutomaticChecks -boolean NO
Options +FollowSymLinks
# # Turn on URL rewriting
RewriteEngine On
# Installation directory
RewriteBase /
# Protect hidden files from being viewed
<Files .*>

Here's the problem I was having...

I have a singleton object which is first instantiated inside my NSDocument's windowControllerDidLoadNib:. It attempts to fetch a password from the user's default keychain using EMKeychain. For over a week, this was working fine.

At some point I noticed that the password fetch would fail with an errSecAuthFailed error. However, it would only fail on every other app launch. Literally. Launch the app, it works. Quit, relaunch (with or without rebuilding) and it fails. Quit, launch again, it works. I reproduced this behavior 20 launches in a row, consistently. Cleaning all and rebuilding didn't change anything. Neither did locking/unlocking the keychain, restarting the Mac, etc.

After going back through numerous revisions, I tracked the problem down to the build where I first added Sparkle. Because this app is currently in beta testing, I have Sparkle configured to check for updates on every launch inside my app delegate like so:

  • (vo
Here's the problem I was having...
I have a singleton object which is first instantiated inside my NSDocument's windowControllerDidLoadNib:. It attempts to fetch a password from the user's default keychain using EMKeychain[1]. For over a week, this was working fine.
At some point I noticed that the password fetch would fail with an errSecAuthFailed error. However, it would only fail on every other app launch. Literally. Launch the app, it works. Quit, relaunch (with or without rebuilding) and it fails. Quit, launch again, it works. I reproduced this behavior 20 launches in a row, consistently. Cleaning all and rebuilding didn't change anything. Neither did locking/unlocking the keychain, restarting the Mac, etc.
After going back through numerous revisions, I tracked the problem down to the build where I first added Sparkle. Because this app is currently in beta testing, I have Sparkle configured to check for updates on every launch inside my app delegate like so:
- (void)applicationDidFinishLaunching
@tylerhall
tylerhall / gist:792971
Created January 24, 2011 08:26
Inserts your most recent git commit hash into your app's Info.plist
<?PHP
$fn = "{$_ENV['BUILT_PRODUCTS_DIR']}/{$_ENV['WRAPPER_NAME']}/Contents/Info.plist";
$rev = trim(`git rev-parse HEAD`);
$plist = file_get_contents($fn);
$plist = preg_replace('/CFBundleVersion<\/key>.*?<string>(.*?)<\/string>/ms', "CFBundleVersion</key>\n\t<string>$rev</string>", $plist);
file_put_contents($fn, $plist);
/Applications/XAMPP/etc/httpd.conf
/private/etc/hosts
/private/etc/apache2/extra/httpd-vhosts.conf