Skip to content

Instantly share code, notes, and snippets.

@Ghostff
Ghostff / gist:34f253c5b2b11f6a2323a524731eed4a
Last active October 26, 2023 20:07
US state and cities (not all)
{
"AL": [
"Tuscaloosa",
"Hoover",
"Mobile",
"Huntsville",
"Montgomery",
"Birmingham",
"Dothan"
],
@Ghostff
Ghostff / country_code_alpha2_alpha3_name
Last active July 1, 2021 12:48
PHP ISO 3166 Country Code Lists
<?php return [
['code' => '004', 'alpha2' => 'AF', 'alpha3' => 'AFG', 'name' => 'Afghanistan'],
['code' => '248', 'alpha2' => 'AX', 'alpha3' => 'ALA', 'name' => 'Åland Islands'],
['code' => '008', 'alpha2' => 'AL', 'alpha3' => 'ALB', 'name' => 'Albania'],
['code' => '012', 'alpha2' => 'DZ', 'alpha3' => 'DZA', 'name' => 'Algeria'],
['code' => '016', 'alpha2' => 'AS', 'alpha3' => 'ASM', 'name' => 'American Samoa'],
['code' => '020', 'alpha2' => 'AD', 'alpha3' => 'AND', 'name' => 'Andorra'],
['code' => '024', 'alpha2' => 'AO', 'alpha3' => 'AGO', 'name' => 'Angola'],
['code' => '660', 'alpha2' => 'AI', 'alpha3' => 'AIA', 'name' => 'Anguilla'],
['code' => '010', 'alpha2' => 'AQ', 'alpha3' => 'ATA', 'name' => 'Antarctica'],
var_dump($_POST); // empty on reload.
if (isset($_POST['upload']))
{
$selected = $_FILES['files']['tmp_name'];
foreach ($selected as $tmp_name) {
var_dump($tmp_name);
}
}
default:
autoload:
'': tests/behat/bootstrap
suites:
default:
paths:
features: "%paths.base%/tests/behat/"
contexts:
- BehatContexts\FeatureContext
extensions:
@Ghostff
Ghostff / Php color array
Last active March 18, 2017 00:48
PHP color (R, G, B) array
#source: http://www.workwithcolor.com/color-chart-full-01.htm (GUI)
$color = [
'Air Force Blue' => [93, 138, 168],
'Alice Blue' => [240, 248, 255],
'Alizarin' => [227, 38, 54],
'Amaranth' => [229, 43, 80],
'Amber' => [255, 191, 0],
'Android Green' => [164, 198, 57],
'Apple Green' => [141, 182, 0],
@Ghostff
Ghostff / rgb_to_hex_to_rgb.php
Created May 13, 2016 15:40 — forked from Pushplaybang/rgb_to_hex_to_rgb.php
php functions convert hex to rgb and rgb to hex
function hex2rgb($hex) {
$hex = str_replace("#", "", $hex);
if(strlen($hex) == 3) {
$r = hexdec(substr($hex,0,1).substr($hex,0,1));
$g = hexdec(substr($hex,1,1).substr($hex,1,1));
$b = hexdec(substr($hex,2,1).substr($hex,2,1));
} else {
$r = hexdec(substr($hex,0,2));
$g = hexdec(substr($hex,2,2));