Skip to content

Instantly share code, notes, and snippets.

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

Emeka Mbah digitlimit

🏠
Working from home
View GitHub Profile
@stevebauman
stevebauman / league-table.php
Last active May 28, 2023 06:37
League Table PHP Challenge
<?php
class LeagueTable
{
public function __construct(array $players)
{
$this->standings = [];
foreach($players as $index => $p) {
$this->standings[$p] = [
'index' => $index,
@nerandell
nerandell / code-review-checklist.md
Last active May 21, 2024 17:43
PHP Code Review Guidelines

Make sure these boxes are checked before submitting/approving the PR

General

  • The code works
  • The code is easy to understand
  • Follows coding conventions
  • Names are simple and if possible short
  • Names are spelt correctly
  • Names contain units where applicable
  • There are no usages of magic numbers
@santoshachari
santoshachari / Laravel PHP7 LEMP AWS.md
Last active February 20, 2024 10:00
Laravel 5.x on Ubuntu 16.x, PHP 7.x, Nginx 1.9.x

#Steps to install latest Laravel, LEMP on AWS Ubuntu 16.4 version. This tutorial is the improvised verision of this tutorial on Digitalocean based on my experience.

Install PHP 7 on Ubuntu

Run the following commands in sequence.

sudo apt-get install -y language-pack-en-base
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install zip unzip
@segebee
segebee / gist:5dec39398e719fdfd0ef
Created June 22, 2015 17:27
Nigeria States and Local Government Areas SQL - codingsavvy.com
-- -- Table structure for table `states` -- CREATE TABLE IF NOT EXISTS `states` ( `state_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(100) NOT NULL, PRIMARY KEY (`state_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=38 ; -- -- Dumping data for table `states` -- INSERT INTO `states` (`state_id`, `name`) VALUES (1, 'Abia State'), (2, 'Adamawa State'), (3, 'Akwa Ibom State'), (4, 'Anambra State'), (5, 'Bauchi State'), (6, 'Bayelsa State'), (7, 'Benue State'), (8, 'Borno State'), (9, 'Cross River State'), (10, 'Delta State'), (11, 'Ebonyi State'), (12, 'Edo State'), (13, 'Ekiti State'), (14, 'Enugu State'), (15, 'FCT'), (16, 'Gombe State'), (17, 'Imo State'), (18, 'Jigawa State'), (19, 'Kaduna State'), (20, 'Kano State'), (21, 'Katsina State'), (22, 'Kebbi State'), (23, 'Kogi State'), (24, 'Kwara State'), (25, 'Lagos State'), (26, 'Nasarawa State'), (27, 'Niger State'), (28, 'Ogun State'), (29, 'Ondo State'), (30, 'Osun State'), (31, 'Oyo State'), (32, 'Plateau State'), (33, 'Rivers State'), (3
@Kartones
Kartones / postgres-cheatsheet.md
Last active July 23, 2024 09:14
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@danielgreen
danielgreen / ValidateHiddenFields.js
Last active October 26, 2023 14:19
The jQuery Validation plugin does not validate hidden fields by default. Here is how to get around that.
// By default, the jQuery Validation plugin ignores hidden fields. You may want them to be validated however.
// The default 'ignore' setting is ':hidden'
// See https://github.com/jzaefferer/jquery-validation/issues/189
// Attach a validator to a particular form, with a blank 'ignore' setting.
// If you are using Unobtrusive Validation then you can't do this, as the Unobtrusive script initialises the plugin for you.
// Instead, you must either amend the setting on the validator once it's attached to the form,
// or amend the default setting before the validator is attached (read on to see how).
$("MyForm").validate({ ignore: "" });