Skip to content

Instantly share code, notes, and snippets.

View johnabela's full-sized avatar
🏠
Working from home

John Abela johnabela

🏠
Working from home
View GitHub Profile

Keybase proof

I hereby claim:

  • I am johnabela on github.
  • I am abela (https://keybase.io/abela) on keybase.
  • I have a public key ASC5tKhN0gyNG-sHKE77ylFQuh1APL_ZoGZ0SCUbw4ecCgo

To claim this, I am signing this object:

/**
* Check to see if an array is suppose to have specific keys.
* This does not check to see if the keys have any values, it
* only checks to see if the keys exists.
*
* @usage
* $array = ['key' => 'meh', 'secret' => 'why'];
* $requiredKeys = ['key', 'secret'];
* array_RequiredKeys($requiredKeys, $array);
*
@johnabela
johnabela / key.asc
Created April 19, 2019 12:10
PGP Key
-----BEGIN PGP PUBLIC KEY BLOCK-----
Comment: https://keybase.io/abela
Version: Keybase Go 2.6.2 (windows)
xsFNBFutaj0BEADZzFhdstGCNE4AlWgIC7sP0sSVCpRP7O4quiaVxUcXqLaeEBnA
opr1icEJPExoUVjfZ7VatOCWgtHqhi+Szi2byM4giRBdaXGWD+wRgNIJHUpn/xaK
v4UTr+YUMZSVkibGXLU403YYV75ExzsDQEKUAkoQw3hbEsHb/XZ1HcnILwAubxG3
wkwwP6LjNPdlK6EXUD+Fr/jyyrNHZTr8qrQz1qw2gsQGD/TZ+vNUaeNpoO3+jPbK
0eh5eJFAm8lQp3vfoW5Jy2zvCNOUKKwGzalGiB3ZQkc0NtcO3vBUiz/YQUmPg6uz
+6bUNuMpkiHiEsugEFBmFjDUf1Cvy8bR8EKBEAI14yQ+oRb/lJ+p4KAQLHUTGAiT
@johnabela
johnabela / [php] Today Minus 1 Week
Created April 21, 2019 16:02
A nice php one-liner to return a formated date of whatever today is, minus one week.
$TodayMinusOneWeek = (new DateTime())->modify('-1 week')->format('Y-m-d');
@4cm I was wondering if you would be willing to contact me. I am the owner of 4cm.com and would really love to be able to use the @4cm account to be able to release some github repositories from. You can see my contact info on my github account @johnabela Thanks!
$start = new DateTime('now');
$end = new DateTime('- 7 day');
$diff = $end->diff($start);
$interval = DateInterval::createFromDateString('-1 day');
$period = new DatePeriod($start, $interval, $diff->days);
foreach ($period as $date) {
echo $date->format('m-d') . '<br>'; // or whatever you want to do
}
@johnabela
johnabela / [php] get domain name
Last active December 24, 2020 11:00
get domain name (without tld) from uri
$url = (substr($url, 0, 4) != 'http') ? 'http://'.$url : $url;
$url = preg_replace('~\.(com|info|net|io|us|org|me|co\.uk|ca|mobi)\b~i','',parse_url($url)['host']);
$url = substr($url,strrpos($url,'.')+1);
// examples:
// 'server.google.co.uk/abela'; // returns: google
// 'https://www.facebook.com/abela/'; // returns: facebook