Skip to content

Instantly share code, notes, and snippets.

View aitchkhan's full-sized avatar
💭
Ehsaan

Haroon Khan aitchkhan

💭
Ehsaan
View GitHub Profile
  sequenceDiagram
    participant User
    participant WebApplication
    participant Cache
    participant TriggerService
    participant Mainframe

    User ->> WebApplication: Access rates page
 WebApplication ->> Cache: Check cache for rates
@aitchkhan
aitchkhan / Nehal-Progress-Tracker.md
Last active October 12, 2022 09:42
Nehal Progress Tracker

ERD feedback:

ERD

  1. We need just one table for users, which will contain all user information. Hence, we will not need registration, login, reset_password, account_info.
  2. Customer contact form does not need a customer reference. because, we assume that this is an anonymous user.
  3. We don't need Customer table either, because orders can be associated with User tables directly.
  4. Product table can be renamed to Vehicles.
  5. Order can be renamed to Receipts.
  6. We can move all the fields of Order_details to Receipt

1. Compile nginx with rtmp module

Clone nginx-rtmp-module

$ git clone https://github.com/sergey-dryabzhinsky/nginx-rtmp-module.git

Install nginx dependencies

@aitchkhan
aitchkhan / pizzas.sql
Created January 9, 2019 15:31
Pizzas for winter school
//create database:
create database pizzaApi;
// create ingredients table:
CREATE TABLE `ingredients` (
`id` INT NOT NULL AUTO_INCREMENT,
`name` VARCHAR(45) NOT NULL,
`key` VARCHAR(45) NOT NULL,
@aitchkhan
aitchkhan / git.txt
Last active March 7, 2018 09:58
git
delete branches that are merged in master develop
git branch --merged | egrep -v "(^\*|master|develop)" | xargs git branch -d
@aitchkhan
aitchkhan / aggregates.js
Created December 8, 2017 03:38
Here is a sample test written with mocha + chai + sinon
describe('Error case(s)', () => {
it('should return type required error', (done) => {
repos.favorites.contentIdsCount.resolves(contentIdsCountResponse);
expect(services.aggregates.view({skip: 0, pageSize: 15, type: 'randomType'}))
.to.eventually.be.rejected.and.be.an.instanceOf(errorHelper.BadRequestError)
.and.eventually.deep.equal(new errorHelper.BadRequestError([messages.validation.aggregateType.enum]))
.notify(done);
});
});
@aitchkhan
aitchkhan / launch.json
Created December 4, 2017 13:02
VS-Code configuration for debugging CINC server, scheduler, tests
// add this in configuration block
{
"type": "node",
"request": "launch",
"name": "Debug Server",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run-script",
"debug"
1. How callbacks work!!
2. Closure.
3. Prototypes.
ES6 Concepts
Let and const
classes and inheritance
teplate literals
string methods and number methods
default params and spread operator
set maps weakset weakmap
@aitchkhan
aitchkhan / $push.js
Created February 2, 2017 12:26
pushes multiple embedded doc to an array
//pushes multiple embedded doc to array
db.latestItems.update({}, {
$push: {
items: {
$each: [ {item_name: 'third item', price: 20 }, {item_name: 'forth item', price: 50 }]
}
}
@aitchkhan
aitchkhan / api.js
Last active January 11, 2017 12:10
'use strict';
var express = require('express');
var controller = require('./post.controller');
const fileUpload = require('../../lib/helpers/fileUpload');
var router = express.Router();
router.get('/', controller.index);
router.get('/:id', controller.getPostById);
router.post('/', fileUpload.single('image'), controller.createPost2); //this is how it is going to consume in an api or endpoint