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 | |
| import UIKit | |
| class Alert { | |
| class func showBasic(title: String, message: String, vc: UIViewController) { | |
| let alert = UIAlertController(title: title, message: message, preferredStyle: .alert) | |
| alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil)) | |
| vc.present(alert, animated: true) | |
| } |
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
| extension String { | |
| var isValidEmail: Bool { | |
| let emailFormat = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}" | |
| let emailPredicate = NSPredicate(format:"SELF MATCHES %@", emailFormat) | |
| return emailPredicate.evaluate(with: 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
| using System.Text.RegularExpressions; | |
| namespace test | |
| { | |
| class RemoveComments | |
| { | |
| public string removeComments(string input) | |
| { | |
| string multiLineCommentPattern = "(/\\*.*?\\*/)"; | |
| string singleLineCommentPattern = "(//.*(\n|\\\\n))"; |
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
| def reverse(x): | |
| """ | |
| :type x: int | |
| :rtype: int | |
| """ | |
| maxInt = 2 ** 31 - 1 | |
| minInt = -1 * 2 ** 31 | |
| if x < 0: | |
| y = -1 * int(str(-x)[::-1]) | |
| else: |
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
| //run npm i axios | |
| const axios = require("axios"); | |
| const url = | |
| "https://maps.googleapis.com/maps/api/geocode/json?address=Florence"; | |
| axios | |
| .get(url) | |
| .then(response => { | |
| console.log( | |
| `City: ${response.data.results[0].formatted_address} -`, | |
| `Latitude: ${response.data.results[0].geometry.location.lat} -`, |
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 | |
| var nums = [0,0,1,1,1,2,2,3,3,4] | |
| let unique = Array(Set(nums)).sorted().count | |
| print (unique) |
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
| { | |
| "classifier_ids": [ | |
| "boxing_punch_525398221" | |
| ], | |
| "owners": ["me"], | |
| "threshold": 0.1 | |
| } |
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
| var https = require('https'); | |
| exports.handler = function(event, context) { | |
| var req = https.request(event.url, function(res) { | |
| console.log('STATUS: ' + res.statusCode); | |
| console.log('HEADERS: ' + JSON.stringify(res.headers)); | |
| res.setEncoding('utf8'); | |
| res.on('data', function (chunk) { | |
| console.log('BODY: ' + chunk); |
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> | |
| <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> | |
| <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> | |
| <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> | |
| <!--[if gt IE 8]><!--> | |
| <html class="no-js"> | |
| <!--<![endif]--> | |
| <head> | |
| <meta charset="utf-8"> |
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
| let array = [1,2,3,5,7,8,9] | |
| let result = array.filter {($0 > 3)} | |
| print (result) |