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
// | |
// NSString+FileTextEncodingAttribute.h | |
// Adapted from http://github.com/scrod/nv/blob/master/NSString_NV.m | |
// | |
#import <Foundation/Foundation.h> | |
#include <sys/xattr.h> | |
@interface NSString (FileTextEncodingAttribute) |
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
@implementation NSLocale (Misc) | |
- (BOOL)timeIs24HourFormat { | |
NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; | |
[formatter setLocale:self]; | |
[formatter setDateStyle:NSDateFormatterNoStyle]; | |
[formatter setTimeStyle:NSDateFormatterShortStyle]; | |
NSString *dateString = [formatter stringFromDate:[NSDate date]]; | |
NSRange amRange = [dateString rangeOfString:[formatter AMSymbol]]; | |
NSRange pmRange = [dateString rangeOfString:[formatter PMSymbol]]; | |
BOOL is24Hour = (amRange.location == NSNotFound && pmRange.location == NSNotFound); |
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
#define ApplicationDelegate ((MyAppDelegate *)[[UIApplication sharedApplication] delegate]) | |
#define UserDefaults [NSUserDefaults standardUserDefaults] | |
#define SharedApplication [UIApplication sharedApplication] | |
#define Bundle [NSBundle mainBundle] | |
#define MainScreen [UIScreen mainScreen] | |
#define ShowNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = YES | |
#define HideNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = NO | |
#define NetworkActivityIndicatorVisible(x) [UIApplication sharedApplication].networkActivityIndicatorVisible = x | |
#define NavBar self.navigationController.navigationBar | |
#define TabBar self.tabBarController.tabBar |
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
/* | |
* System Versioning Preprocessor Macros | |
*/ | |
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame) | |
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending) | |
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending) | |
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending) | |
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending) |
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
// Depreciation Suppression | |
@protocol SuppressDepreciationWarning | |
- (void)setStatusBarHidden:(BOOL)hidden animated:(BOOL)animated; // UIApplication - Deprecated in iPhone OS 3.2 | |
@end | |
// Hide status bar | |
if ([UIApplication instancesRespondToSelector:@selector(setStatusBarHidden:withAnimation:)]) { | |
[SharedApplication setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide]; | |
} else { | |
[(id <SuppressDepreciationWarning>)SharedApplication setStatusBarHidden:YES animated:YES]; // Depreciated |
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
// | |
// NSDate+InternetDateTime.h | |
// MWFeedParser | |
// | |
// Created by Michael Waterfall on 07/10/2010. | |
// Copyright 2010 Michael Waterfall. All rights reserved. | |
// | |
#import <Foundation/Foundation.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
#!/usr/bin/env python | |
# Taken from | |
# http://code.activestate.com/recipes/577708-check-for-package-updates-on-pypi-works-best-in-pi/ | |
import xmlrpclib | |
import pip | |
pypi = xmlrpclib.ServerProxy('http://pypi.python.org/pypi') | |
for dist in pip.get_installed_distributions(): |
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
# | |
# Recursively validates all python files with pyflakes that were modified | |
# since the last validation, and provides basic stats. Ignores hidden | |
# directories. | |
# | |
# NOTE: | |
# You should set your favourite version control system to ignore | |
# the validate.db file that is used to track when which files | |
# have changed since last validation. | |
# |
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
require 'formula' | |
class Python < Formula | |
homepage 'http://www.python.org' | |
head 'http://hg.python.org/cpython', :using => :hg, :branch => '2.7' | |
url 'http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2' | |
sha1 '842c4e2aff3f016feea3c6e992c7fa96e49c9aa0' | |
option :universal | |
option 'quicktest', 'Run `make quicktest` after the build (for devs; may fail)' |
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
require 'formula' | |
class Redis < Formula | |
homepage 'http://redis.io/' | |
url 'http://download.redis.io/releases/redis-2.6.16.tar.gz' | |
sha1 'f94c0f623aaa8c310f9be2a88e81716de01ce0ce' | |
head 'https://github.com/antirez/redis.git', :branch => 'unstable' | |
fails_with :llvm do |
OlderNewer