Skip to content

Instantly share code, notes, and snippets.

View raj23manj's full-sized avatar
😎
"I never lose... either I win or I learn."

raj23manj

😎
"I never lose... either I win or I learn."
View GitHub Profile
@raj23manj
raj23manj / app.js
Created November 26, 2021 03:04 — forked from joshnuss/app.js
Express.js role-based permissions middleware
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./authorization"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection
@raj23manj
raj23manj / web-servers.md
Created July 28, 2021 01:08 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@raj23manj
raj23manj / System Design.md
Created May 18, 2021 06:41 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@raj23manj
raj23manj / customdao.md
Created December 29, 2018 10:43 — forked from esfand/customdao.md
Spring Custom UserDetails

How to use Custom DAO class in Spring Security

Source

  • Objective 1 : Use Custom DAO classes in Spring Security Spring Security provides mechanism by which we can specify database queries in spring security xml file , but sometimes we want to use our own custom dao classes which are already built.
  • Objective 2 : Forward the request to different home pages based on the authorized role
@raj23manj
raj23manj / promises.js
Created October 25, 2018 13:37 — forked from ahallora/promises.js
How to properly nest functions returning Promises (ECMA6) in node.js (Nested Promises example)
/*
How to properly nest functions returning Promises (ECMA6) in node.js (Nested Promises example)
generated output (with 1 second ticks) =>
p1 function
p2 function
p3 function
p3 done
p2 done
@raj23manj
raj23manj / Converting libraries to Ember CLI addons.md
Created August 2, 2018 10:53 — forked from kristianmandrup/Converting libraries to Ember CLI addons.md
Guide to Developing Addons and Blueprints for Ember CLI

Converting libraries to Ember CLI addons

In this guide we will cover two main cases:

  • Ember specific library
  • vendor library

Ember library

The Ember library will assume that Ember has already ben loaded (higher in the loading order) and thus will assume it has access to the Ember API.

@raj23manj
raj23manj / 1. highcharts.component.ts
Created May 17, 2018 15:59 — forked from fabiobiondi/1. highcharts.component.ts
Simple HighChart component in Angular 5
import { AfterViewInit, Component, ElementRef, Input, OnChanges, SimpleChanges, ViewChild } from '@angular/core';
import { HighChartService } from './highchart.service';
@Component({
selector: 'fb-highchart',
template: '<div *ngIf="config"></div>',
providers: [HighChartService]
})
export class HighChartComponent implements OnChanges, AfterViewInit {
@Input() config: any;