Skip to content

Instantly share code, notes, and snippets.

Open for consultation , Freelance and excited to collaborate and contribute


Open for consultation , Freelance and excited to collaborate and contribute
View GitHub Profile
View gist:a92fb309293d7843a82d9e8b47b1f88c
contentSecurityPolicy: {
directives: {
defaultSrc: ["'self'"],
scriptSrc: ["'self'","","","'unsafe-inline'"],
styleSrc: ["'self'", '', "'unsafe-inline'"],
imgSrc: ["'self'", 'https://*.com'],
fontSrc: ["'self'", 'https://*.com', 'data:']
View app.js
//const pinoInspector = require("pino-inspector");
const path = require("path");
const fastify = require("fastify")({
//logger: { prettyPrint: true, level: "debug", prettifier: pinoInspector },
ajv: {
plugins: [[require("ajv-keywords"), ["transform"]]],
View API Response
View customResponse
"rows": [{
"employeesid": 20667909,
"first_name": "joi",
"last_name": "baker",
"gender": "M",
"birth_date": "2020-01-02T00:00:00.000Z",
"recordstate": true,
"created_date": "2020-12-06T09:17:39.413Z",
"updated_date": "2020-12-06T09:17:39.413Z"
View gist:4094152be78ed2604313badff5ab115c
File Refer
I would to optimized below query
select a.gender from "employees" as a
where lower( gender ) LIKE 'f%' group by gender
limit 20
matt212 /
Last active Nov 19, 2020
Nodejs+postgres+redis Env Setup for App
sudo apt update
sudo apt install nodejs
sudo apt install npm
sudo apt-get update
sudo apt install postgresql postgresql-contrib
sudo apt install redis-server
sudo service redis-server start
matt212 / meh.js
Created Mar 22, 2019
convert json array to js object
View meh.js
var newObj = internObj.reduce((a, b) => Object.assign(a, b), {})
View meh.json
"openapi": "3.0.0",
"info": {
"description": "This is a sample server Petstore server.",
"version": "1.0.0",
"title": "Swagger Petstore",
"termsOfService": "",
"contact": {
"email": ""
matt212 / sample.yaml
Created Jan 31, 2019
multiple keys issues with different payload
View sample.yaml
swagger: "2.0"
description: "This is a sample server Petstore server. You can find out more about Swagger at []( or on [, #swagger]( For this sample, you can use the api key `special-key` to test the authorization filters."
version: "1.0.0"
title: "Swagger Petstore"
termsOfService: ""
email: ""
name: "Apache 2.0"
matt212 / base.html
Last active May 15, 2018
Custom Modular Multiselect plugin and its implementation
View base.html
reason for creating this plugin
which states that We need to modify our server api for client side plugin feature which is reallllly BAD !
also if you guys find any multiselect + autopopulate with ajax and edit mechanism please comment below on gist !
1. include modular-multiselect-plugin.js in base.html
2. include data-utils.js & plugin-enduser-implementation.js in base.html
3. include modular-multiselector.css in base.html