Skip to content

Instantly share code, notes, and snippets.

View harryWonder's full-sized avatar
🇳🇬
I am that software developer that you cannot sideline. I am <harrywonder/>

Ilori stephen harryWonder

🇳🇬
I am that software developer that you cannot sideline. I am <harrywonder/>
View GitHub Profile
@harryWonder
harryWonder / RegisterModel.php
Last active May 15, 2020 00:17
This file extends the Db.php Class and provides two methods for creating a new user and fetching a new user.
<?php
require_once(__dir__ . '/Db.php');
class RegisterModel extends Db {
/**
* @param array
* @return array
* @desc Creates and returns a user record....
**/
public function createUser(array $user) :array
@harryWonder
harryWonder / Dashboard.php
Last active May 15, 2020 00:22
This file houses a class which loads in some dependencies from the DashboardModel.php file.
<?php
require_once(__dir__ . '/Controller.php');
require_once('./Model/DashboardModel.php');
class Dashboard extends Controller {
public $active = 'dashboard'; //for highlighting the active link...
private $dashboardModel;
/**
* @param null|void
@harryWonder
harryWonder / Login.php
Last active May 15, 2020 07:04
This file loads in the LoginModel Controller and it also extends the base controller.
<?php
require_once(__dir__ . '/Controller.php');
require_once('./Model/LoginModel.php');
class Login extends Controller {
public $active = 'login'; //for highlighting the active link...
private $loginModel;
/**
@harryWonder
harryWonder / Register.php
Last active May 15, 2020 07:05
This class extends the base controller and loads in the RegisterModel as a dependency
<?php
require_once(__dir__ . '/Controller.php');
require_once('./Model/RegisterModel.php');
class Register extends Controller {
public $active = 'Register'; //for highlighting the active link...
private $registerModel;
/**
* @param null|void
@harryWonder
harryWonder / Logout.php
Last active May 15, 2020 07:06
This file houses a logout class which extends the base controller. This class destroys the application session and performs an http redirect.
<?php
require_once(__dir__ . '/Controller.php');
class Logout extends Controller {
/**
* @param null|void
* @return null|void
* @desc Destroys the application session and redirects to the login page...
**/
@harryWonder
harryWonder / config.php
Created May 15, 2020 07:17
This file creates some sane defaults or constants for the application.
<?php
define("BASE_URL", 'http://localhost/' . basename(__DIR__) . '/');
?>
@harryWonder
harryWonder / ContinentController.js
Created May 17, 2020 21:42
This gist acts as my continent controller
const _ = require('lodash');
/****************************************************************/
/************ Custom Module Imports *********************/
/****************************************************************/
const Controller = require('./Controller');
const ContinentModel = require('../model/ContinentModel');
class ContinentController extends Controller {
constructor() {
@harryWonder
harryWonder / package.json
Created May 26, 2020 12:02
This is the package.json file for the cli app in node.js
{
"name": "node-cli-app",
"version": "1.0.0",
"description": "A cli app in node js for getting details about the weather.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
@harryWonder
harryWonder / index.js
Created May 26, 2020 12:34
This file serves as the entry point into our application by executing different commands from the terminal.
//Node Modules....
const Yargs = require('yargs');
//Custom Modules....
const Notes = require('./app/Notes');
const Weather = require('./app/Weather');
//App Initialization...
const YargsArgV = Yargs
.command('add', 'Adds A New Note', {
@harryWonder
harryWonder / Notes.js
Last active June 4, 2020 08:56
This file uses a mongodb connection to handle some crud operations for the node-cli-app
const { MongoClient } = require('mongodb');
const _ = require('lodash');
class Notes {
constructor() { }
// Create A New Mongo Connection...
async createConnection() {
// Mongo Config || Constants.....
const Url = 'mongodb://localhost:27017';