Skip to content

Instantly share code, notes, and snippets.

View ankit-kumar-jat's full-sized avatar
🎯
Focusing

ankit kumar jat ankit-kumar-jat

🎯
Focusing
View GitHub Profile
@ankit-kumar-jat
ankit-kumar-jat / sassas.md
Created September 5, 2022 17:31 — forked from AdamMarsden/sassas.md
Sass Architecture Structure

Sass Architecture Structure

sass/
|
|– base/
|   |– _reset.scss       # Reset/normalize
|   |– _typography.scss  # Typography rules
|   ...                  # Etc…
|
@ankit-kumar-jat
ankit-kumar-jat / load-script.js
Created August 31, 2022 10:08
Load javascript file dynamically
/**
*
* @param {String} url scrip url
* @param {String} id id for script tag
* @returns promise
*/
const loadScript = (url, id) => {
return new Promise((resolve) => {
const existingScript = document.getElementById(id);
if (existingScript) resolve(true);
@ankit-kumar-jat
ankit-kumar-jat / axiosBaseQuery.js
Last active June 15, 2023 18:10
Axios Base Query for RTK Query (redux toolkit)
import axios from 'axios'
export const axiosBaseQuery =
({ baseUrl, prepareHeaders }) => {
return async ({ url, method, body: data, params, ...rest }, api) => {
try {
// this to allow prepare headers
if (prepareHeaders) {
axios.interceptors.request.use(function (config) {
@ankit-kumar-jat
ankit-kumar-jat / roles_invesitgation.md
Created May 27, 2022 03:20 — forked from facultymatt/roles_invesitgation.md
Roles and permissions system for Nodejs
@ankit-kumar-jat
ankit-kumar-jat / nginx-tuning.md
Created October 4, 2021 06:29 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@ankit-kumar-jat
ankit-kumar-jat / sw.js
Created December 1, 2020 08:53 — forked from DannyMoerkerke/sw.js
Full-fledged service worker which caches API requests and responses using IndexedDB
const version = 1;
const cacheName = `our_awesome_cache`
// the static files we want to cache
const staticFiles = [
'index.html',
'src/css/styles.css',
'src/img/logo.png',
'src/js/app.js'
];