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 | |
extension UIFont { | |
private var weight: CGFloat { | |
if let traits = fontDescriptor.object(forKey: UIFontDescriptorTraitsAttribute) as? NSDictionary, | |
let weight = traits[UIFontWeightTrait] as? CGFloat { | |
return weight | |
} | |
return 0 | |
} |
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
public func getItemsFromSystemProfiler(dataTypeString: String) -> [[String:AnyObject]]? { | |
let task = Process() | |
let pipe = Pipe() | |
// Set up our task process | |
task.launchPath = "/usr/sbin/system_profiler" | |
task.arguments = ["-xml", dataTypeString] | |
task.standardOutput = pipe | |
// Go! |
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
/* | |
*** Academy Engraved LET *** | |
AcademyEngravedLetPlain | |
--------------------- | |
*** Al Nile *** | |
AlNile | |
AlNile-Bold | |
--------------------- | |
*** American Typewriter *** | |
AmericanTypewriter |
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
/// Validate email string | |
/// | |
/// - parameter email: A String that rappresent an email address | |
/// | |
/// - returns: A Boolean value indicating whether an email is valid. | |
func isValid(_ email: String) -> Bool { | |
let emailRegEx = "(?:[a-zA-Z0-9!#$%\\&‘*+/=?\\^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%\\&'*+/=?\\^_`{|}” + | |
“~-]+)*|\“(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\” + | |
“x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\“)@(?:(?:[a-z0-9](?:[a-” + | |
“z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5" + |
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
// | |
// ProfileViewController.swift | |
// Drizzle | |
// | |
// Created by George on 2016-04-17. | |
// Copyright © 2016 George. All rights reserved. | |
// | |
import UIKit | |
import IBAnimatable |
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
#!/bin/sh | |
# "Delete all unavailable devices." | |
xcrun simctl delete unavailable |
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
/* Add this line to bookmarks and use when you see | |
* "Oops! You've got a lot of code in this diff and it couldn't load with the page." | |
* on a pull request at Bitbucket. | |
*/ | |
javascript:(function(){[].forEach.call(document.querySelectorAll(".load-diff"),function(a){a.click()})})(); |
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
- (UIImage *)pspdf_preloadedImage { | |
CGImageRef image = self.CGImage; | |
// make a bitmap context of a suitable size to draw to, forcing decode | |
size_t width = CGImageGetWidth(image); | |
size_t height = CGImageGetHeight(image); | |
CGColorSpaceRef colourSpace = CGColorSpaceCreateDeviceRGB(); | |
CGContextRef imageContext = CGBitmapContextCreate(NULL, width, height, 8, width*4, colourSpace, | |
kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Little); |
NewerOlder