Key/Command | Description |
---|---|
Tab | Auto-complete files and folder names |
Ctrl + A | Go to the beginning of the line you are currently typing on |
Ctrl + E | Go to the end of the line you are currently typing on |
Ctrl + U | Clear the line before the cursor |
Ctrl + K | Clear the line after the cursor |
Ctrl + W | Delete the word before the cursor |
Ctrl + T | Swap the last two characters before the cursor |
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
// Asyncronous programming | |
import Foundation | |
// # Async-await samples | |
// ## Instead of using callbacks, ... | |
func getEmployeesJSON(url: URL, callback: @escaping ([Employee]) -> ())) { | |
URLSession.shared.dataTask(with: url), let response, response as? HTTPURLResponse, error == nil else { | |
if let let error = error { | |
print("Error downloading: \(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
import Foundation | |
import var CommonCrypto.CC_MD5_DIGEST_LENGTH | |
import func CommonCrypto.CC_MD5 | |
import typealias CommonCrypto.CC_LONG | |
extension String { | |
func md5() -> String { | |
let length = Int(CC_MD5_DIGEST_LENGTH) | |
let messageData = data(using: .utf8)! | |
var digestData = Data(count: length) |
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 ruby | |
begin | |
project = ARGV[0] | |
server = ARGV[1] | |
if project.nil? | |
raise "<project> not specified" | |
end | |
if server.nil? |
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
// | |
// OSDNIValidator.swift | |
// OSFramework | |
// | |
// Created by Daniel Vela on 21/09/2016. | |
// Copyright © 2016 Daniel Vela. All rights reserved. | |
// | |
import Foundation | |
/** |
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
// To decode a json where the type to decode is in the json itself like: | |
// [{ "type": "foo", "payload": { "word": "hello" "push_id": 3711282988, "size": 1, } }, { "type": "bar", "payload": { "size": 1, "radious": 0.5 } }] | |
struct FooPayload: Codable { | |
var word: String | |
var push_id: Int | |
var size: 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 | |
class BlinkingImage: UIImageView { | |
override func awakeFromNib() { | |
super.awakeFromNib() | |
UIView.animate(withDuration: 1.2, | |
delay: 0.0, | |
options: [.autoreverse, .repeat, .curveEaseInOut], | |
animations: { | |
self.alpha = 0.10 |
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
// | |
// Optional.swift | |
// UserLogin | |
// | |
// Created by Daniel Vela Angulo on 17/03/2020. | |
// Copyright © 2020 TBM. All rights reserved. | |
// | |
extension Optional where Wrapped == String { | |
var isNilOrEmpty: 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
// | |
// Observer.swift | |
// TestAspect | |
// | |
// Created by Daniel Vela on 12/01/2020. | |
// Copyright © 2020 veladan. All rights reserved. | |
// | |
protocol Observer { | |
associatedtype 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
// | |
// User.swift | |
// TestAspect | |
// | |
// Created by Daniel Vela on 12/01/2020. | |
// Copyright © 2020 veladan. All rights reserved. | |
// | |
@propertyWrapper | |
struct Logger<Value> { |
NewerOlder