A mixin for writing @font-face rules in SASS.
Create a font face rule. Embedded OpenType, WOFF2, WOFF, TrueType, and SVG files are automatically sourced.
@include font-face(Samplino, fonts/Samplino);| import CoreData | |
| protocol Fetchable | |
| { | |
| typealias FetchableType: NSManagedObject | |
| static func entityName() -> String | |
| static func objectsInContext(context: NSManagedObjectContext, predicate: NSPredicate?, sortedBy: String?, ascending: Bool) throws -> [FetchableType] | |
| static func singleObjectInContext(context: NSManagedObjectContext, predicate: NSPredicate?, sortedBy: String?, ascending: Bool) throws -> FetchableType? | |
| static func objectCountInContext(context: NSManagedObjectContext, predicate: NSPredicate?) -> Int |
| @IBAction func viewDragged(sender: UIPanGestureRecognizer) { | |
| let yTranslation = sender.translationInView(view).y | |
| if (hasExceededVerticalLimit(topViewConstraint.constant)){ | |
| totalTranslation += yTranslation | |
| topViewConstraint.constant = logConstraintValueForYPoisition(totalTranslation) | |
| if(sender.state == UIGestureRecognizerState.Ended ){ | |
| animateViewBackToLimit() | |
| } | |
| } else { | |
| topViewConstraint.constant += yTranslation |
| /* | |
| To use: | |
| * save this script as migrate.js | |
| * fill in the user/pass variables at the top | |
| * save the block of json below as package.json right next to it | |
| * install node.js from nodejs.org | |
| * run 'npm install' from the directory where you saved the files | |
| * run 'node migrate.js' | |
| * profit |
| import Foundation | |
| import UIKit | |
| extension UIColor { | |
| convenience init(hexString:String) { | |
| let hexString:NSString = hexString.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet()) | |
| let scanner = NSScanner(string: hexString) | |
| if (hexString.hasPrefix("#")) { | |
| scanner.scanLocation = 1 |
| import Foundation | |
| /// An abstract class that makes building simple asynchronous operations easy. | |
| /// Subclasses must implement `execute()` to perform any work and call | |
| /// `finish()` when they are done. All `NSOperation` work will be handled | |
| /// automatically. | |
| open class AsynchronousOperation: Operation { | |
| // MARK: - Properties |
| /** | |
| http://mythosil.hatenablog.com/entry/20111017/1318873155 | |
| http://blog.dealforest.net/2012/03/ios-android-per-aes-crypt-connection/ | |
| */ | |
| @interface NSData (AES) | |
| - (NSData *)AES128EncryptedDataWithKey:(NSString *)key; | |
| - (NSData *)AES128DecryptedDataWithKey:(NSString *)key; | |
| - (NSData *)AES128EncryptedDataWithKey:(NSString *)key iv:(NSString *)iv; |
| a: AM/PM | |
| A: 0~86399999 (Millisecond of Day) | |
| c/cc: 1~7 (Day of Week) | |
| ccc: Sun/Mon/Tue/Wed/Thu/Fri/Sat | |
| cccc: Sunday/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday | |
| d: 1~31 (0 padded Day of Month) | |
| D: 1~366 (0 padded Day of Year) | |
Generate the list yourself:
$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep UI_APPEARANCE_SELECTOR ./* | \
sed 's/NS_AVAILABLE_IOS(.*)//g' | \
sed 's/NS_DEPRECATED_IOS(.*)//g' | \
sed 's/API_AVAILABLE(.*)//g' | \
sed 's/API_UNAVAILABLE(.*)//g' | \
sed 's/UI_APPEARANCE_SELECTOR//g' | \
An index-title-scrubber-bar, for use with a
UICollectionView(or even aPSTCollectionView). Gives a collection view the index title bar for-sectionIndexTitlesthat aUITableViewgets for (almost) free. A huge thank you to @Yang from [this Stack Overflow post][so], which saved my bacon here.
When you're using a UITableView and you define the UITableViewDataSource method -sectionIndexTitlesForTableView:, you get a sweet right-hand-side view for scrubbing through a long table view of fields, separated by sections. The titles are the names of the sections, by default (or at least letters based on the section names).