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 LLNode<T> { | |
var value: T | |
var next: LLNode? | |
weak var previous: LLNode? | |
init(value: T) { | |
self.value = value | |
} | |
} |
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 | |
class ViewController: UIViewController { | |
let viewOne = UIView() | |
let viewTwo = UIView() | |
let intermediaryView = UIView() | |
let viewSuper = UIView() | |
override func viewDidLoad() { |
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 | |
typealias JSON = [String : Any] | |
fileprivate let imageCache = NSCache<NSString, UIImage>() | |
extension NSError { | |
static func generalParsingError(domain: String) -> Error { | |
return NSError(domain: domain, code: 400, userInfo: [NSLocalizedDescriptionKey : NSLocalizedString("Error retrieving data", comment: "General Parsing Error Description")]) | |
} | |
} |
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 | |
typealias JSON = [String: Any] | |
final class iTunesAPIClient: NSObject { | |
var activeDownloads: [String: Download]? | |
weak var defaultSession: URLSession? = URLSession(configuration: .default) | |
// MARK: - Main session used |
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 | |
protocol ImageDownloadProtocol { | |
func downloadImage(from url: URL, completion: @escaping (UIImage?) -> Void) | |
} | |
extension ImageDownloadProtocol { | |
func downloadImage(from url: URL, completion: @escaping (UIImage?) -> Void) { | |
let session = URLSession(configuration: .default) | |
DispatchQueue.global(qos: .background).async { |
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 palindrome(string: String) -> Bool { | |
var replacedString = string.replacingOccurrences(of: " ", with: "") | |
replacedString = replacedString.components(separatedBy:.punctuationCharacters).joined() | |
return replacedString.lowercased() == String(replacedString.lowercased().reversed()) | |
} |
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 ViewController: UIViewController, ARSCNViewDelegate, ARSessionDelegate { | |
@IBOutlet weak var sceneView: ARSCNView! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
} | |
func run() { | |
let configuration = ARWorldTrackingConfiguration() |
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
def main(): | |
crawl = WebCrawler() | |
new_data = crawl.request_resource() | |
if new_data is not None: | |
for url in new_data: | |
print(url) |
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
def request_resource(self): | |
r = requests.get(self.url) | |
urls = re.findall('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', r.text) | |
return urls |
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
def __init__(self): | |
print(sys.argv[0]) | |
if sys.argv[1].startswith("http://") or sys.argv[1].startswith("https://"): | |
self.url = sys.argv[1] | |
else: | |
self.url = "https://" + sys.argv[1] |
NewerOlder