Skip to content

Instantly share code, notes, and snippets.

View kvn1234's full-sized avatar
๐Ÿ™€

Kevin Borchers kvn1234

๐Ÿ™€
View GitHub Profile
@kvn1234
kvn1234 / state_names.txt
Last active November 2, 2021 18:58 — forked from norcal82/state_names.txt
plain text of US state names
// https://gist.github.com/dblandin/2991970
Alabama
Alaska
American Samoa
Arizona
Arkansas
California
Colorado
Connecticut
@kvn1234
kvn1234 / Validator.php
Created July 28, 2019 02:06 — forked from waleedrehmankhan/Validator.php
Custom Laravel Alphanumeric Validator that allow spaces
Paste this Code in Validator.php
public function validateAlphaSpaces($attribute, $value, $params)
{
return preg_match('/^[\pL\s]+$/u', $value);
}
Create Custom Message some where at bottom in Validation.php
/*
the reported geolocation info of a domain URL fast with this quick #oneliner:
curl -s ipinfoโ€‹.io/`dig +short exampleโ€‹.com` | tr -d '",{}'
@kvn1234
kvn1234 / Form regex
Created January 25, 2019 01:59
Regex I seem to need a lot
(\ autocomplete\=\")([a-z\-0-9\_\"]+)
@kvn1234
kvn1234 / gist:fe76665ce6aa6b31563f6233287b6d2e
Created January 22, 2019 12:01
Show/hide password field with Jquery simplified
$('.reveal').on('click', function() {
var reveal = '.' + $(this).attr('id'), // reveal's id *should* be to-be-revealed's class
type = $(reveal).attr('type') === 'password' ? 'text' : 'password';
$(reveal).attr('type', type);
});
@kvn1234
kvn1234 / gist:16c31778d473e705cb8fb9b43851622b
Last active January 22, 2019 02:47
Laravel RegEx for updating a form to show both old values while editing a form
(value\=\"\{\{\ old\(\')([a-z\-\_]+)(\')(\)\ \}\}\")
usage: $1$2$3\,\ \$variableObject\->$2$4
works as long as:
$2 is the same key as the column name (or whatever is in the object coming back)
see https://regex101.com/r/DfQngW/1
@kvn1234
kvn1234 / timezones_array.php
Created December 22, 2018 14:37 — forked from pavellauko/LICENSE
Time zones as arrays (PHP)
<?php
$timezones = array(
'America/Adak' => '(GMT-10:00) America/Adak (Hawaii-Aleutian Standard Time)',
'America/Atka' => '(GMT-10:00) America/Atka (Hawaii-Aleutian Standard Time)',
'America/Anchorage' => '(GMT-9:00) America/Anchorage (Alaska Standard Time)',
'America/Juneau' => '(GMT-9:00) America/Juneau (Alaska Standard Time)',
'America/Nome' => '(GMT-9:00) America/Nome (Alaska Standard Time)',
'America/Yakutat' => '(GMT-9:00) America/Yakutat (Alaska Standard Time)',
'America/Dawson' => '(GMT-8:00) America/Dawson (Pacific Standard Time)',
@kvn1234
kvn1234 / swapassignment regex
Created December 22, 2018 00:34
The swap assignment function PHPStorm should have but doesn't
(\s*)([^=^\s]*)\s*=\s*(.*);
$1$3 = $2;
@kvn1234
kvn1234 / foreign_keys
Created August 10, 2018 17:15
Find foreign keys from information_schema
SELECT * FROM KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_NAME = 'table_name' AND REFERENCED_COLUMN_NAME = 'id'
@kvn1234
kvn1234 / uuid.php
Created July 2, 2018 18:53
Generate v4 UUID (requires PHP 7)
<?php
/*
* this will generate a valid v4 UUID per Google's directive for use in the -sessiontoken- parameter
*/
function guidv4($data)
{
assert(strlen($data) == 16);
$data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100
$data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10