This file contains hidden or 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
| # Your init script | |
| # | |
| # Atom will evaluate this file each time a new window is opened. It is run | |
| # after packages are loaded/activated and after the previous editor state | |
| # has been restored. | |
| # | |
| # An example hack to log to the console when each text editor is saved. | |
| # | |
| # atom.workspace.observeTextEditors (editor) -> | |
| # editor.onDidSave -> |
This file contains hidden or 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 tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool { | |
| if let fromView = tabBarController.selectedViewController?.view, | |
| let toView = viewController.view, fromView != toView, | |
| let controllerIndex = self.viewControllers?.index(of: viewController) { | |
| let viewSize = fromView.frame | |
| let scrollRight = controllerIndex > tabBarController.selectedIndex | |
| // Avoid UI issues when switching tabs fast |
This file contains hidden or 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 | |
| extension UIColor { | |
| convenience init(P3ReadyRed red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat = 1.0, forceP3IfAvailable: Bool = true) { | |
| if #available(iOS 10.0, *), forceP3IfAvailable { | |
| self.init(displayP3Red: red, green: green, blue: blue, alpha: alpha) | |
| } else { | |
| self.init(red: red, green: green, blue: blue, alpha: alpha) | |
| } |
This file contains hidden or 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
| #include <iostream> | |
| #include <random> | |
| using namespace std; | |
| unsigned long long randomNumber(unsigned long long upperLimit = mt19937_64::max()) { | |
| random_device rd; | |
| mt19937_64 generator(rd()); | |
| return generator() % upperLimit; | |
| } |
This file contains hidden or 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 GameplayKit | |
| extension Collection { | |
| func shuffled() -> [Iterator.Element] { | |
| let shuffledArray = (self as? NSArray)?.shuffled() | |
| let outputArray = shuffledArray as? [Iterator.Element] | |
| return outputArray ?? [] | |
| } | |
| mutating func shuffle() { | |
| if let selfShuffled = self.shuffled() as? Self { |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>hola</title> | |
| </head> | |
| <body> | |
| <input id="sliderValueInput" type="text" style="width: 3em" value="0"> | |
| <input id="slider" type="range" value="0"> | |
| </body> |
This file contains hidden or 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
| // | |
| // UITextView+Extension.swift | |
| // | |
| // Created by Daniel Illescas Romero on 21/05/2017. | |
| // | |
| import UIKit | |
| extension UITextView { | |
This file contains hidden or 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 | |
| extension String { | |
| mutating func isValidEmail() -> Bool { | |
| guard !self.lowercased().hasPrefix("mailto:") else { return false } | |
| guard let emailDetector = try? NSDataDetector(types: NSTextCheckingResult.CheckingType.link.rawValue) else { return false } | |
This file contains hidden or 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
| #include <iostream> | |
| using namespace std; | |
| string to_string(const string& str) { return str; } | |
| class Any { | |
| shared_ptr<void*> value_ { nullptr }; | |
This file contains hidden or 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
| #include <chrono> | |
| #include <chrono> | |
| namespace evt { | |
| template <typename Function> | |
| float benchmark(const Function& function, size_t iterations = 1) { | |
| float averageTime = 0.0; | |