Skip to content

Instantly share code, notes, and snippets.

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

Adewuyi Taofeeq Olamilekan harmlessprince

🏠
Working from home
View GitHub Profile
@pavellauko
pavellauko / timezones_array.php
Created July 10, 2012 10:35
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)',
@artschwagerb
artschwagerb / routers.py
Created November 14, 2013 19:20
Django Database Routers Master-Slave
import random
class MasterSlaveRouter(object):
def db_for_read(self, model, **hints):
"""
Reads go to a randomly-chosen slave.
"""
return random.choice(['master','slave1', 'slave2'])
def db_for_write(self, model, **hints):
@solancer
solancer / apache-nginx-ftp
Created July 27, 2016 10:53
Correct permissions for /var/www/html
// Adding current user to www-data
sudo adduser $USER www-data
//change ownership to user:www-data and
sudo chown $USER:www-data -R /var/www/html
sudo chmod u=rwX,g=srX,o=rX -R /var/www/html
// change file permissions of existing files and folders to 755/644
sudo find /var/www/html -type d -exec chmod g=rwxs "{}" \;
@mofesolapaul
mofesolapaul / nigeria-states.json
Last active July 23, 2024 15:58
List of all Nigerian states, alphabetically arranged in JSON array
[
"Abia",
"Adamawa",
"Akwa Ibom",
"Anambra",
"Bauchi",
"Bayelsa",
"Benue",
"Borno",
"Cross River",
@zuhairkareem
zuhairkareem / search_partial_string_array.php
Last active June 24, 2024 19:54
Search partial string in an array in PHP
<?php
/**
* First Method.
*/
function array_search_partial($arr, $keyword) {
foreach($arr as $index => $string) {
if (strpos($string, $keyword) !== FALSE)
return $index;
}
}
@Propaganistas
Propaganistas / MailHog configuration
Last active July 24, 2024 18:33
Laravel MailHog SMTP configuration
# Mailhog
MAIL_MAILER=smtp
MAIL_HOST=0.0.0.0
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
@mstenta
mstenta / parse-kml.php
Last active February 8, 2024 07:36 — forked from woodbri/parse-kml.php
Script to parse a kml file
<?php
// Enter the name of the KML file here.
$kml_filename = '';
$xml = simplexml_load_file($kml_filename);
$folders = $xml->Document->Folder;
foreach ($folders as $folder) {
print "Name: " . $folder->name . "\n";
print "Description: " . $folder->description . "\n";
@Pezhvak
Pezhvak / supervisor-mac-installation.md
Last active November 15, 2023 13:35
Supervisor Mac Installation (Laravel)

alright, everybody writen one about this but nothing worked for me, here's how it works without any problem:

first run brew install supervisor

run brew services start supervisor now to start supervisor, this will make sure supervisor runs at startup as well.

supervisor searches for configuration file in following paths: /usr/local/etc/supervisord.conf, /usr/local/supervisord.conf, supervisord.conf, etc/supervisord.conf, /etc/supervisord.conf, /etc/supervisor/supervisord.conf

we have to create one in order for it to work:

@ajepe
ajepe / md
Created January 15, 2019 07:56
Nigeria Banks sort code
{
"070010": "ABBEY MORTGAGE BANK-070010",
"044": "ACCESS BANK PLC-044",
"323": "AccessMobile-100013",
"090134": "ACCION MICROFINANCE BANK-090134",
"090160": "ADDOSSER MICROFINANCE BANK-090160",
"100028": "AG MORTGAGE BANK PLC-100028",
"090133": "AL-BARAKAH MICROFINANCE BANK-090133",
"090180": "AMJU UNIQUE MICROFINANCE BANK-090180",
"090116": "AMML MFB-090116",
@arthursalvtr
arthursalvtr / add-custom-mail-driver-to-laravel.md
Last active April 5, 2024 17:43
Add Custom Mail Driver to Laravel

How to add custom Mail Driver to Laravel

Tested on Laravel 5.8

Within the source code of laravel 5.8 at this time of writing, we have this following

<?php

namespace Illuminate\Support;