Skip to content

Instantly share code, notes, and snippets.

View atomicbird's full-sized avatar

Tom Harrington atomicbird

View GitHub Profile
@atomicbird
atomicbird / UIView+comment.swift
Created May 16, 2019 16:50
Add a comment field in Xcode storyboards
@IBInspectable var comment: String {
set {}
get { return "" }
}
@atomicbird
atomicbird / ManagedObjectDeletionFiringFault.swift
Created March 5, 2018 23:20 — forked from AndrewBennet/ManagedObjectDeletionFiringFault.swift
A Swift playground demonstrating that deleting an NSManagedObject causes a fault to fire
import CoreData
import PlaygroundSupport
// Build a simple model in code for demo purposes.
// The model has a single entity called "Entity" with a single optional string attribute called "testAttribute".
// There are no relationships in the model.
let model = NSManagedObjectModel()
let entity = NSEntityDescription()
entity.name = "Entity"
let testAttribute = NSAttributeDescription()
struct x {
int y;
};
@interface Game : NSObject {
char fields[9];
BOOL singlePlayer;
BOOL isPlayerOne;
BOOL wasPlayerOne;
long int played;
@atomicbird
atomicbird / gist:5327568
Created April 6, 2013 20:46
WWDC Page update, 2013-04-06
diff --git a/archives/wwdccheck.html b/archives/wwdccheck.html
index 713b830..93d4f4f 100644
--- a/archives/wwdccheck.html
+++ b/archives/wwdccheck.html
@@ -6,7 +6,7 @@
<meta name="viewport" content="width=1024" />
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="icon" href="/favicon.ico" />
-<link rel="stylesheet" href="https://devimages.apple.com.edgekey.net/assets/core/styles/base.css" type="text/css" />
+<link rel="stylesheet" href="/assets/core/styles/base.css" type="text/css" />
@atomicbird
atomicbird / gist:5250398
Last active December 15, 2015 11:08
WWDC page update, 2013-03-26
diff --git a/archives/wwdccheck.html b/archives/wwdccheck.html
index f92ed3a..713b830 100644
--- a/archives/wwdccheck.html
+++ b/archives/wwdccheck.html
@@ -60,7 +60,7 @@
var s_account="appleglobal,appleusdeveloper"
</script>
-<!-- <script type="text/javascript" src="https://ssl.apple.com/metrics/scripts/s_code_h.js"></script> -->
+<script type="text/javascript" src="https://www.apple.com/metrics/scripts/s_code_h.js"></script>
@atomicbird
atomicbird / gist:5216685
Last active December 15, 2015 06:29
WWDC page update, 2013-03-21
diff --git a/archives/wwdccheck.html b/archives/wwdccheck.html
index be95ffd..f92ed3a 100644
--- a/archives/wwdccheck.html
+++ b/archives/wwdccheck.html
@@ -60,7 +60,7 @@
var s_account="appleglobal,appleusdeveloper"
</script>
-<script type="text/javascript" src="https://ssl.apple.com/metrics/scripts/s_code_h.js"></script>
+<!-- <script type="text/javascript" src="https://ssl.apple.com/metrics/scripts/s_code_h.js"></script> -->
@atomicbird
atomicbird / com.getsync.bittorrentsync.plist
Last active December 5, 2015 15:44 — forked from tjluoma/sync.com.tjluoma.bittorrentsync.plist
Keep BitTorrent Sync running on OS X. This version launches BitTorrent Sync directly instead of using /usr/bin/open, so that crashes will be detected.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<dict>
<key>Crashed</key>
<true/>
<key>SuccessfulExit</key>
<false/>
@atomicbird
atomicbird / fixpng.sh
Created June 2, 2012 00:05
Bash functions for easily "fixing" iOS-optimized PNG files (based on https://gist.github.com/2854083)
# Fix an iOS-converted PNG
fixpng () {
if [ -z "$1" ]; then
echo "Usage: fixpng <inputFile> [outputFile]"
return -1
else
inputFile=$1
# Only "png" and "PNG" are allowed
pngRegex='.*.(png|PNG)$'
@atomicbird
atomicbird / half-past-midnight.m
Created May 7, 2012 21:27
Half past midnight
#import <Foundation/Foundation.h>
// Get an NSDate representing 30 minutes past midnight in an arbitrary time zone, and print it in a readable form.
// Tom Harrington, tph@atomicbird.com
int main(int argc, char *argv[]) {
NSAutoreleasePool *p = [[NSAutoreleasePool alloc] init];
NSString *timeZoneName = @"America/New_York";
NSTimeZone *timeZone = [NSTimeZone timeZoneWithName:timeZoneName];
NSManagedObjectContext *theCreatingMOC = theChildMOC;
[theCreatingMOC performBlockAndWait:^{
// Insert some test data...
NSManagedObject *thePerson = [NSEntityDescription insertNewObjectForEntityForName:@"Person" inManagedObjectContext:theCreatingMOC];
[thePerson setValue:@"Steve Jobs" forKey:@"name"];
NSManagedObject *theCompany = [NSEntityDescription insertNewObjectForEntityForName:@"Company" inManagedObjectContext:theCreatingMOC];
[theCompany setValue:@"Apple" forKey:@"name"];