- 1Password
- Xcode
- bear
- homebrew
- intelliJ IDEA
- iXLIFF
- Tweetbot
- TextMate
- Gimp
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
extension Data { | |
var md5 : String { | |
var digest = [UInt8](repeating: 0, count: Int(CC_MD5_DIGEST_LENGTH)) | |
_ = self.withUnsafeBytes { bytes in | |
CC_MD5(bytes, CC_LONG(self.count), &digest) | |
} | |
var digestHex = "" | |
for index in 0..<Int(CC_MD5_DIGEST_LENGTH) { | |
digestHex += String(format: "%02x", digest[index]) | |
} |
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
version: "3.8" | |
services: | |
db: | |
image: mysql:latest | |
volumes: | |
- ./db/data:/var/lib/mysql | |
ports: | |
- "3306:3306" | |
restart: always |
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
// sepcifiy your errors | |
enum MyCustomError : Error { | |
case customError | |
case missingProperty | |
var localizedDescription: String { | |
switch self { | |
case .urlCouldNotBeCreated: | |
return NSLocalizedString("MyCustomErrorCcustomError", value: "a localized error message", comment: "") | |
case .missingProperty: |
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
SELECT DATE_FORMAT(FROM_UNIXTIME(`date`), '%e %b %Y %H:%m:%s') AS created, temp, humid FROM `table_name` ORDER BY id DESC LIMIT 1; |
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
extension String { | |
var isValidEmail: Bool { | |
let emailRegEx = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}" | |
let emailTest = NSPredicate(format:"SELF MATCHES %@", emailRegEx) | |
return emailTest.evaluate(with: self) | |
} | |
} |
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
extension UIImage { | |
/** | |
returns an UIImage with the given height | |
**/ | |
func resizedImage(newHeight: CGFloat) -> UIImage { | |
let scale = newHeight / self.size.height | |
let newWidth = self.size.width * scale | |
UIGraphicsBeginImageContext(CGSize(width: newWidth, height: newHeight)) | |
self.draw(in: CGRect(x: 0, y: 0, width: newWidth, height: newHeight)) | |
let newImage = UIGraphicsGetImageFromCurrentImageContext() |
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
class MyView: UIView { | |
private let gradient = CAGradientLayer() | |
override func draw(_ rect: CGRect) { | |
super.draw(rect) | |
gradient.colors = [UIColor.red.cgColor, UIColor.blue.cgColor] // beliebig viele Farben für den Verlauf einstellen | |
gradient.startPoint = CGPoint(x: 0, y: 0) // über start und endPoint kann die Richtung des Verlaufes verändert werden. | |
gradient.endPoint = CGPoint(x: 0, y: 1) |
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
wget -qO- http://checkip.dyndns.org | sed -e 's/^.*s: //' -e 's_</b.*$__' |
NewerOlder