This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import requests # Requires install | |
import json | |
import random | |
import io | |
import itertools as IT | |
from xml.etree import ElementTree | |
from xml.etree.ElementTree import Element | |
from xml.etree.ElementTree import SubElement |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import json | |
import os | |
import argparse | |
from textwrap import dedent | |
def pascalCase(str): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// UICollectionViewFlowLayout+NoFade.m | |
// | |
// Created by Rob Booth on 3/4/14. | |
#import "UICollectionViewFlowLayout+NoFade.h" | |
#import <objc/runtime.h> | |
@implementation UICollectionViewFlowLayout (NoFade) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In trying to debug and NSPredicate I typically find myself delving into the sqlite commandline interface to run the queries manually to see what happens. I just now ran into doing some queries dealing with timestamps which led to alot of frustration, so I hope this helps someone. | |
1. NSDate uses 01/01/2001 00:00:00 GMT as it's reference date, this is very important to know. This date converts to 978307200 as a unix timestamp, which is a number you will be using later. | |
2. CoreData, stores dates as timestamps from the above reference date. | |
3. SQLite has a couple of date functions that work off of the unix epoch, which is 1/1/1970 00:00:00 GMT. Using these functions you can effectively query your CoreData store. | |
4. The strftime('%s', 'now') function will return to you the current time as a timetamp from the unix epoch, unfortunately this is returned as a string so you'll need to cast it to use in comparison query. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NSMutableURLRequest+MultipartBatch.h | |
// | |
// Created by Rob Booth on 1/17/14. | |
// | |
#import <Foundation/Foundation.h> | |
@interface NSMutableURLRequest (MultipartBatch) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# Setup | |
# | |
# 1. Create a directory to hold your 3rd party code, each module in it's own named directory (i.e. 3rdParty/AFNetworking). | |
# 2. Make sure under the module directory there is the LICENSE file (file must have LICENSE all uppercase in the name) | |
# 3. In your Settings.bundle add a row to the Root.plist with: Type=PSChildPaneSpecifier, Filename=Acknowledgements, Name=Acknowledgements. | |
# 4. In the script below, | |
# - set the settingsDir to the directory where the Settings.bundle resides (if not source root), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// FaderView.h | |
// | |
// Created by Rob Booth on 11/6/12. | |
// | |
// | |
// Usage | |
// [[FaderView alloc] initWithFrame:CGRectZero color:[UIColor redColor] andDirection:FaderViewDirectionDown]; | |
#import <UIKit/UIKit.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "SBJson.h" | |
#import <Foundation/Foundation.h> | |
#import <objc/runtime.h> | |
@interface MYJSONSerialization : NSObject | |
+ (NSData *)dataWithJSONObject:(id)obj options:(NSJSONWritingOptions)opt error:(NSError **)error; | |
+ (id)JSONObjectWithData:(NSData *)data options:(NSJSONReadingOptions)opt error:(NSError **)error; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
#import <CoreData/CoreData.h> | |
@interface UITableView (FetchedResultsControllerDelegate) <NSFetchedResultsControllerDelegate> | |
@end | |
@implementation UITableView (FetchedResultsControllerDelegate) | |
- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller |
NewerOlder