This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
This file contains hidden or 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
| // Line Height Bookmarklet | |
| // javascript:(function(lineHeight) %7B%0A if (window.guide) %7B%0A document.body.removeChild(window.guide)%3B%0A window.guide %3D null%3B%0A %7D else %7B%0A window.guide %3D document.createElement("div")%3B%0A guide.style.id %3D "grid_overlay"%3B%0A guide.style.position %3D "absolute"%3B%0A guide.style.left %3D "0"%3B%0A guide.style.top %3D "-1px"%3B%0A guide.style.width %3D "100%25"%3B%0A guide.style.height %3D (document.body.clientHeight > document.documentElement.clientHeight) %3F document.body.clientHeight %2B "px" %3A "100%25"%3B%0A guide.style.pointerEvents %3D "none"%3B%0A guide.style.userSelect %3D "none"%3B%0A guide.style.background %3D "linear-gradient(rgba(0%2C 119%2C 179%2C 0.2) 1px%2C transparent 1px) left top %2F " %2B lineHeight %2B " " %2B lineHeight%3B%0A document.body.appendChild(guide)%0A %7D%0A%7D)("27px")%3B%0A | |
| (function(lineHeight) { | |
| if (window.guide) { | |
| document.body.removeChild(window.guide); | |
| window.guide = |
This file contains hidden or 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
| struct ImageDescriptor<ImageReference> { | |
| var imageReference: ImageReference | |
| var properties: UIImageView.Properties | |
| } | |
| extension UIImageView { | |
| struct Properties { | |
| var contentMode: UIViewContentMode | |
| var backgroundColor: UIColor | |
| var tintColor: UIColor |
This file contains hidden or 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
| extension UIImageView { | |
| func apply(_ imageDescriptor: ImageDescriptor<UIImage>) | |
| func apply( | |
| _ imageDescriptor: ImageDescriptor<URL>, | |
| loading loadingImageDescriptor: ImageDescriptor<UIImage>? = nil, | |
| failure failureImageDescriptor: ImageDescriptor<UIImage>? = nil | |
| ) | |
| } |
This file contains hidden or 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
| extension ImageDescriptor where ImageReference == UIImage { | |
| static let logo = ImageDescriptor<UIImage>( | |
| imageReference: UIImage(named: "logo")!.withRenderingMode(.alwaysTemplate), | |
| properties: UIImageView.Properties( | |
| contentMode: .center, | |
| backgroundColor: .white, | |
| tintColor: .lightGray, | |
| accessibilityIdentifier: "logoImage" | |
| ) | |
| ) |
OlderNewer