Skip to content

Instantly share code, notes, and snippets.

@kumarrishav
kumarrishav / dynamic_nginx_brotli.sh
Created March 18, 2021 22:44 — forked from fvztdk/dynamic_nginx_brotli.sh
Build and install google brotli nginx as a dynamic module (ubuntu xenial)
#install brotli
sudo apt-get install brotli
#check nginx version
nginx -V
#download nginx source
wget http://nginx.org/download/nginx-1.14.1.tar.gz
#extract the source
tar -xzvf nginx-1.14.1.tar.gz
@kumarrishav
kumarrishav / delete-node-modules.yml
Created November 19, 2020 21:53 — forked from bnb/delete-node-modules.yml
Delete `node_modules` on push to the default branch
name: Delete node_modules on merge
on:
push:
branches:
- [ $default-branch ]
jobs:
delete-modules:
runs-on: ubuntu-latest
steps:
@kumarrishav
kumarrishav / index.js
Created March 8, 2019 08:58
Medium Blog: Leveraging Docker Multi-Stage Builds to optimize Dockerfile/Image
const https = require('https');
https.get('https://api.nasa.gov/planetary/apod?api_key=<api_key>', (resp) => {
let data = '';
// A chunk of data has been recieved.
resp.on('data', (chunk) => {
data += chunk;
});
@kumarrishav
kumarrishav / setproxy
Created August 16, 2018 20:03 — forked from beradrian/setproxy
Set proxy for npm and git
# set a proxy
set HTTP_PROXY=
set HTTPS_PROXY=%HTTP_PROXY%
npm config set proxy %HTTP_PROXY%
npm config set https.proxy %HTTPS_PROXY%
npm config set https-proxy %HTTPS_PROXY%
git config --global http.proxy %HTTP_PROXY%
git config --global https.proxy %HTTPS_PROXY%
# unset proxy

Array<T>

Legend:

  • ✏️ method changes this.
  • 🔒 method does not change this.

Array<T>.prototype.*:

  • concat(...items: Array): T[] 🔒 ES3
  • 🎨 when improving the format/structure of the code
  • 🚀 when improving performance
  • ✏️ when writing docs
  • 💡 new idea
  • 🚧 work in progress
  • ➕ when adding feature
  • ➖ when removing feature
  • 🔈 when adding logging
  • 🔇 when reducing logging
  • 🐛 when fixing a bug
--log_gc (Log heap samples on garbage collection for the hp2ps tool.)
type: bool default: false
--expose_gc (expose gc extension)
type: bool default: false
--max_new_space_size (max size of the new generation (in kBytes))
type: int default: 0
--max_old_space_size (max size of the old generation (in Mbytes))
type: int default: 0
--max_executable_size (max size of executable memory (in Mbytes))
type: int default: 0
@kumarrishav
kumarrishav / Object Flatten
Created May 24, 2017 09:07 — forked from penguinboy/Object Flatten
Flatten javascript objects into a single-depth object
var flattenObject = function(ob) {
var toReturn = {};
for (var i in ob) {
if (!ob.hasOwnProperty(i)) continue;
if ((typeof ob[i]) == 'object') {
var flatObject = flattenObject(ob[i]);
for (var x in flatObject) {
if (!flatObject.hasOwnProperty(x)) continue;
/*
* Flatten Object @gdibble: Inspired by https://gist.github.com/penguinboy/762197
* input: { 'a':{ 'b':{ 'b2':2 }, 'c':{ 'c2':2, 'c3':3 } } }
* output: { 'a.b.b2':2, 'a.c.c2':2, 'a.c.c3':3 }
*/
var flattenObject = function(ob) {
var toReturn = {};
var flatObject;
for (var i in ob) {
if (!ob.hasOwnProperty(i)) {