Skip to content

Instantly share code, notes, and snippets.

View gchriswill's full-sized avatar
👾
Endless debugging...

Christopher Gonzalez gchriswill

👾
Endless debugging...
View GitHub Profile
@gchriswill
gchriswill / UITableViewOnlyOneRowSelection.swift
Created June 30, 2017 02:46
A snippet for extending a UITableViewController subclass, allowing the selection feature for ONLY one row through the Checkmark accssory.
// A snippet for extending a UITableViewController class,
// allowing the selection of only one row through the Checkmark accssory.
// If you using a stand alone UITableView, then implement these methods in your delegate object.
// For checking which row is selected, check the indexPathForSelectedRow property of the tableView.
// This code is implemented in the latest version of Swift, which is Swift 3, as of today...
extension <#Your UITableViewController class#> {
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
@gchriswill
gchriswill / FindMaxInteger.swift
Created January 19, 2018 22:18
Swift 4 Extension for finding the biggest integer value from an array of integers
extension Array where Element: SignedInteger {
static func findMaxInt(arr:[Int]) -> Int{
var previous = Int()
var max = Int()
arr.forEach { (n) in
max = n > previous && n > max ? n : max
previous = n;
@gchriswill
gchriswill / steppers
Last active August 29, 2015 14:24
Extends Swift's Array structure by providing stepping functionality recursively using an external variable.
// Created on 6/2/15 by Christopher Gonzalez D.K.A. @gchriswill https://github.com/JWShroyer
// Reviewed and optimyzed by Josh Shroyer D.K.A @JWShroyer https://github.com/JWShroyer
// Last revision on 7/11/15 by @gchriswill and @JWShroyer
extension Array {
mutating func countForward(inout counter c: Int) -> Void {
var s = self.count - 1
c = c < s && !(0 > c) ? (c + 1) : 0
@gchriswill
gchriswill / emailCheck.js
Last active August 29, 2015 13:57
This is a validation formula or method condition to validate an email string from an input or text field with JavaScript. (No RegEx, just pure JavaScript)
//Save the value of the field into a variable
var emailValue = emailField.getValue();
/* This formula or method condition in five easy steps
*
* 1- First searches for an "@" in the string
* 2- Then it checks for more than one "@"
* 3- Then checks if the subdomain area is less than 4 characters
* 4- Then checks if the position of the last "." is less than 3 spaces after the "@"
* 5- Then checks if there are two or less characters after the last "."