Skip to content

Instantly share code, notes, and snippets.

👾
Debugging...

Christopher Gonzalez gchriswill

👾
Debugging...
View GitHub Profile
@gchriswill
gchriswill / FindMaxInteger.swift
Created Jan 19, 2018
Swift 4 Extension for finding the biggest integer value from an array of integers
View FindMaxInteger.swift
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 / UITableViewOnlyOneRowSelection.swift
Created Jun 30, 2017
A snippet for extending a UITableViewController subclass, allowing the selection feature for ONLY one row through the Checkmark accssory.
View UITableViewOnlyOneRowSelection.swift
// 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 / steppers
Last active Aug 29, 2015
Extends Swift's Array structure by providing stepping functionality recursively using an external variable.
View steppers
// 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 Aug 29, 2015
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)
View emailCheck.js
//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 "."
You can’t perform that action at this time.