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
/// This is free and unencumbered software released into the public domain. | |
/// | |
/// Anyone is free to copy, modify, publish, use, compile, sell, or | |
/// distribute this software, either in source code form or as a compiled | |
/// binary, for any purpose, commercial or non-commercial, and by any | |
/// means. | |
/// | |
/// In jurisdictions that recognize copyright laws, the author or authors | |
/// of this software dedicate any and all copyright interest in the | |
/// software to the public domain. We make this dedication for the benefit |
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
// | |
// PSPDFThreadSafeMutableDictionary.m | |
// | |
// Copyright (c) 2013 Peter Steinberger, PSPDFKit GmbH. All rights reserved. | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is |
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
// | |
// PMThreadSafeMutableArray.m | |
// | |
// Created by nhatlee on 1/19/18. | |
// Copyright © 2018 nhatlee. All rights reserved. | |
// | |
#import "PMThreadSafeMutableArray.h" | |
#import <libkern/OSAtomic.h> |
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 xcrun swift | |
import Foundation | |
public typealias CharactersArray = [Character] | |
public typealias CharactersHash = [CharactersGroup : CharactersArray] | |
public enum CharactersGroup { | |
case Letters | |
case Numbers |
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
// | |
// UIView+Extension.swift | |
// | |
// Created by Bishal Ghimire on 4/30/16. | |
// Copyright © 2016 Bishal Ghimire. All rights reserved. | |
// | |
import UIKit | |
// |
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 openBrackets: [Character] = ["(", "{", "["] | |
let closedBrackets: [Character] = [")", "}", "]"] | |
func ~=<T: Equatable>(pattern: [T], value: T) -> Bool { | |
return pattern.contains(value) | |
} | |
func isExpressionBalanced(_ expression: String) -> Bool { |
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
// Playground - noun: a place where people can play | |
import Cocoa | |
enum Wildcard : NilLiteralConvertible { | |
case Single | |
case FromBeginning | |
case ToEnd | |
case Range(Int) | |
case Literal(Int) |
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 | |
import RxSwift | |
import RxCocoa | |
let requiredUserNameLength = 5 | |
let requiredPasswordLength = 5 | |
let limitUserNameLength = 20 | |
class ValidationViewController: UIViewController { |
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
protocol DogBreed { | |
typealias Level = Int | |
var breedName: String { get set } | |
var size: Level { get set } | |
var health: Level { get set } | |
var adaptability: Level { get set } | |
var intelligence: Level { get set } | |
var dogType: DogType { get set } |
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*)mmg_imageScaledToFitSize:(CGSize)fitSize | |
{ | |
// Create a vImage_Buffer from the CGImage | |
CGImageRef sourceRef = self.CGImage; | |
vImage_Buffer srcBuffer; | |
vImage_CGImageFormat format = { | |
.bitsPerComponent = 8, | |
.bitsPerPixel = 32, | |
.colorSpace = NULL, | |
.bitmapInfo = (CGBitmapInfo)kCGImageAlphaFirst, |
OlderNewer