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
// Created by Kenny Dubroff on 10/14/18. | |
var str = "p123869" | |
var chars = Array(str) | |
//first 2 characters are always 0 and 1 | |
chars[0] = "*" | |
chars [1] = "*" | |
///endIndex is always one greater than the last index |
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 | |
protocol Fightable { | |
var hitPoints: Int { get set } | |
var damageDone: Int { get set } | |
var damageAbsorbed: Int { get set } | |
} | |
protocol IDAble { | |
var id: Int { get } |
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
.note { | |
max-width: 600px; | |
border-radius: 8px; | |
background-color: lightgray; | |
padding: 4px; | |
margin: 8px; | |
} | |
pre { | |
background: black; |
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
<?php | |
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); | |
//connect to db func | |
if(!function_exists('connectToDb')) { | |
function connectToDb($host, $username, $password, $db_name) { | |
$link; | |
try { | |
$link = new mysqli($host, $username, $password, $db_name); | |
$link->set_charset("utf8mb4"); | |
} catch(Exception $e) { |
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
// Dependency: rwbutler/Connectivity https://github.com/rwbutler/Connectivity | |
import Foundation | |
import Connectivity | |
// MARK: - Delegate Protcol - | |
protocol NetworkMonitorDelegate: class { | |
func updateUser(connected: Bool) | |
} |
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
# Write your code here :-) | |
import time | |
import RPi.GPIO as GPIO | |
GPIO.setmode(GPIO.BCM) | |
# Define LEDs | |
GREEN_LED=14 | |
RED_LED=4 | |
# Setup LEDs |
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
// blueprint | |
/// This protocol is constrained to types that conform to UIView - which is most UI elements | |
protocol BorderView: UIView { | |
func addBorder(borderWidth: CGFloat, borderColor: CGColor) | |
} | |
// default implementation (optional) | |
extension BorderView { | |
func addBorder(borderWidth: CGFloat = 1, borderColor: CGColor = UIColor.lightGray.cgColor) { | |
self.layer.borderWidth = borderWidth |
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
// ExampleTableViewController.swift | |
// Nestor | |
// | |
// Created by Kenneth Dubroff on 2/19/21. | |
// | |
import UIKit | |
class ExampleTableViewController: UITableViewController { |
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 UIViewController { | |
/// Show an alert with a title, message, and OK button | |
/// - Parameters: | |
/// - title: The Alert's Title | |
/// - message: The Alert's Message | |
func presentAlert(title: String, message: String, completion: @escaping (UIAlertAction) -> Void = {_ in }) { | |
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert) |