Follow ALL Apple Naming Conventions!
- Spaces, not tabs.
- Comments should be hard-wrapped at 80 characters.
| import sys | |
| import json | |
| raw_data = open(sys.argv[1]).read().split('\r\n') | |
| csv_headers = raw_data[0].split(',') | |
| csv_data = [piece.split(',') for piece in raw_data[1:]] | |
| json_data = [] | |
| for csv_datum in csv_data: | |
| json_datum = {} |
| // | |
| // Objectify.h | |
| // | |
| // Created by Patrick Perini on 3/21/12. | |
| // Copyright (c) 2012 Inspyre Technologies. MIT License | |
| // | |
| #import <Foundation/Foundation.h> | |
| id __objectify__(char *type, ...); |
| // | |
| // UIAlertView+Blocks.h | |
| // | |
| // Created by Patrick Perini on 3/22/12. | |
| // Copyright (c) 2012 Inspyre Technologies. MIT License. | |
| // | |
| #import <UIKit/UIKit.h> | |
| @interface UIAlertView (Blocks) <UIAlertViewDelegate> |
| // .h | |
| #if !TARGET_OS_IPHONE | |
| #import <Cocoa/Cocoa.h> | |
| #define APPLViewController NSViewController | |
| #else | |
| #import <UIKit/UIKit.h> | |
| #import <Foundation/Foundation.h> | |
| #define APPLViewController UIViewController | |
| #endif |
| // # Assume salt, password, and encodedPassword are all strings. | |
| // # If you don't have a salt, just have a random number generator spit out > 16B of data, and turn that into a string. | |
| // Java - SHA256 with Salt | |
| import java.security.MessageDigest; | |
| import sun.misc.BASE64Encoder; | |
| MessageDigest digest = MessageDigest.getInstance("SHA-256"); | |
| digest.reset(); |
| import threading | |
| def _async(func, *a, **kw): | |
| thread = threading.Thread(target = func, args = a, kwargs = kw) | |
| thread.start() | |
| return thread | |
| def async(func): | |
| return lambda *a, **kw: _async(func, *a, **kw) |
| #!/usr/bin/python | |
| import os | |
| import sys | |
| import subprocess | |
| from optparse import OptionParser | |
| # Superglobal Variables | |
| TERMINAL_FORMATTERS = { | |
| "BOLD": "\033[1m", |
| #import <Cocoa/Cocoa.h> | |
| #import <Foundation/Foundation.h> | |
| interface FileHelper : Object // "Object" is the same as "NSObject" | |
| property (readonly) | |
| String volumeName // both are readonly properties | |
| String volumeFormat // | |
| + pathStringWithComponents: Array, return String // class method |
| // .h | |
| @interface NSNumber (Ranges) | |
| - (NSRange)to:(NSNumber *)rangeEnd; | |
| - (BOOL)isInRange:(NSRange)range; | |
| @end | |
| // .m | |
| @implementation NSNumber (Ranges) |