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
//: A UIKit based Playground for presenting user interface | |
import UIKit | |
import PlaygroundSupport | |
class StrokedPathFillMaskView: UIView { | |
var path: UIBezierPath? { | |
didSet { | |
setNeedsDisplay() | |
} |
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 SomeView { | |
// Declare property as a closure that's lazily executed on evaluation | |
let label: UILabel = { | |
// Create view within closure | |
let view = UILabel() | |
// Do whatever kind of configuration you want on it | |
view.font = .systemFont(ofSize: 14) | |
view.textColor = .blue |
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 that can retrieve nested error messages from Parse cloud code responses | |
// | |
// If you've got cloud code that does something like | |
// | |
// thing.save().then(function(savedThing) { | |
// response.success(); | |
// }, function(error) { | |
// response.error(error); | |
// }); | |
// |
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 bash | |
WORKSPACE=`find . -name "*.xcworkspace" | grep -v "project.xcworkspace"` | |
if [[ -n $WORKSPACE ]]; then | |
$(rm $WORKSPACE/xcuserdata/$USER.xcuserdatad/UserInterfaceState.xcuserstate) | |
else | |
PROJECT=`find . -name "*.xcodeproj"` | |
$(rm $PROJECT/xcuserdata/$USER.xcuserdatad/UserInterfaceState.xcuserstate) | |
fi |
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
func containsEmoji(text: String) -> Bool { | |
var containsEmoji = false | |
for scalar in text.unicodeScalars { | |
switch scalar.value { | |
case 0x1F600...0x1F64F: | |
// Emoticons | |
containsEmoji = true | |
case 0x1F300...0x1F5FF: | |
// Misc Symbols and Pictographs | |
containsEmoji = true |
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 | |
let GfycatPOSTURL = "https://gifaffe.s3.amazonaws.com/" | |
let GfycatPolicy = "eyAiZXhwaXJhdGlvbiI6ICIyMDIwLTEyLTAxVDEyOjAwOjAwLjAwMFoiLAogICAgICAgICAgICAiY29uZGl0aW9ucyI6IFsKICAgICAgICAgICAgeyJidWNrZXQiOiAiZ2lmYWZmZSJ9LAogICAgICAgICAgICBbInN0YXJ0cy13aXRoIiwgIiRrZXkiLCAiIl0sCiAgICAgICAgICAgIHsiYWNsIjogInByaXZhdGUifSwKCSAgICB7InN1Y2Nlc3NfYWN0aW9uX3N0YXR1cyI6ICIyMDAifSwKICAgICAgICAgICAgWyJzdGFydHMtd2l0aCIsICIkQ29udGVudC1UeXBlIiwgIiJdLAogICAgICAgICAgICBbImNvbnRlbnQtbGVuZ3RoLXJhbmdlIiwgMCwgNTI0Mjg4MDAwXQogICAgICAgICAgICBdCiAgICAgICAgICB9" | |
let GfycatAWSAccessKeyId = "AKIAIT4VU4B7G2LQYKZQ" | |
let GfycatSignature = "mk9t/U/wRN4/uU01mXfeTe2Kcoc=" | |
let GfycatTranscodeURL = "http://upload.gfycat.com/transcode/" | |
class GfycatHandler: NSObject { |