Skip to content

Instantly share code, notes, and snippets.

View elishaukpong's full-sized avatar
🇳🇬
Learning something new somewhere!

Elisha Ukpong elishaukpong

🇳🇬
Learning something new somewhere!
View GitHub Profile
@elishaukpong
elishaukpong / CheckForMaintenanceMode.php
Last active July 21, 2020 12:08
Laravel's default check for maintenance middleware class
app/Http/Middleware/CheckForMaintenanceMode.php
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode as Middleware;
class CheckForMaintenanceMode extends Middleware
{
@elishaukpong
elishaukpong / UpCommand.php
Created July 21, 2020 13:30
Bring the application out of maintenance mode
<?php
namespace Illuminate\Foundation\Console;
use Exception;
use Illuminate\Console\Command;
class UpCommand extends Command
{
/**
<?php
/*
* Example code for: PHP 7 Data Structures and Algorithms
*
* Author: Mizanur rahman <mizanur.rahman@gmail.com>
*
*/
class ListNode {
version: '2'
services:
##
# Autodiscovery : Consul
##
autodiscovery:
build: ./autodiscovery/
mem_limit: 128m
expose:
- 53
<!--
Copyright 2018 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
<?php
//NULLSAFE OPERATOR
//class User {
// public function profile(){
// return new Profile;
// }
//}
//
@elishaukpong
elishaukpong / ReflectionAPI
Created July 27, 2021 08:04
This makes a demonstration of the PHP Reflection API
<?php
class Person{
public $name;
public function __construct(string $name){
$this->name = $name;
}
}
@elishaukpong
elishaukpong / ReflectionAPIExample.php
Created August 2, 2021 23:00
An example to drive home the utilisation of the reflection api
<?php
class Browser
{
public static function browse($callable)
{
$params = (new ReflectionFunction($callable))->getParameters();
$args = [];
@elishaukpong
elishaukpong / simpleFactoryExample.php
Last active August 4, 2021 21:02
After learning about the simple factory pattern, i made up a problem scope and used the pattern to solve it.
<?php
//a boy has two shows and can decide to wear anyone of it at any time,
//the below class shows the implementation without applying any design patterns
class ShoeWithoutFactory
{
const CHURCH = 1;
const SCHOOL = 2;
@elishaukpong
elishaukpong / covarianceAndContraVariance.php
Last active August 7, 2021 08:38
I have been thinking of where/how to utilise this concept in a day to day development and i realised this can be utilised in our abstract factory methods design pattern and it's composition. Check on the abstract factory on my other gists to get understanding
<?php
class Food
{
}
class AnimalFood extends Food
{
}