Skip to content

Instantly share code, notes, and snippets.

View officialabdulrehman's full-sized avatar
🥷
Always Learning

Abdul Rehman Nizamani officialabdulrehman

🥷
Always Learning
View GitHub Profile
@officialabdulrehman
officialabdulrehman / observable-pattern-pizza.js
Created October 16, 2021 15:32 — forked from boxgames1/observable-pattern-pizza.js
Observable pattern - Pizza Maker
const EventEmitter = require("events").EventEmitter;
class Pizza extends EventEmitter {
constructor(size = 1) {
super();
this.ovenTime = this._ovenTime(size);
this.maxIngredients = this._maxIngredients(size);
this.ingredients = [];
this.timeToReleasePizza = 5;
}
@officialabdulrehman
officialabdulrehman / dao.js
Created September 26, 2021 17:44 — forked from keyurgolani/dao.js
Node.js Data Access Object (DAO) Template with Self Implemented Connection Pooling
var mysql = require("mysql");
// Configure your logger here
var logger = require("../utils/logger");
// Add a properties file here with the configurations
// For properties file format visit https://github.com/steveukx/properties
var properties = require('properties-reader')('properties.properties');
function getConnection() {
var connection = mysql.createConnection({
host: properties.get('mysql.host'),