Skip to content

Instantly share code, notes, and snippets.

View bishawjit-das's full-sized avatar
🔍
Looking for new opportunities

Bishawjit Das bishawjit-das

🔍
Looking for new opportunities
View GitHub Profile
@bishawjit-das
bishawjit-das / node_nginx_ssl.md
Created September 5, 2020 15:07 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@bishawjit-das
bishawjit-das / gist:d738fd99817af88ba3c41599162b043f
Created August 4, 2020 07:03
Extract only used css from chrome coverage
Improved to work without any files.
PHP Sandbox http://sandbox.onlinephpfunctions.com/
JSON Formater to be converted to 1line https://www.freeformatter.com/json-formatter.html#ad-output
Unmify it https://unminify.com/
$jsont = <<<'EOD'
{ "url":"test"}
@bishawjit-das
bishawjit-das / mysqlsync
Created June 17, 2020 09:43 — forked from samhernandez/mysqlsync
Sync remote mysql database to local over ssh
#!/bin/bash
# This script assumes you have ssh access to a remote server
# Both databases are backed up to sql files in the same directory
# this script is executed from.
# Usage:
# 1. Make sure this file is executable with `chmod +x mysqlsync`
# 2. Set the credentials for the variables at the top
# (Remember, no spaces around the '=' sign)
# 3. Run it from a directory where you'd like the backup files to go:
systemctl list-unit-files --type=service | grep enabled
sudo systemctl list-unit-files --type=service | grep enabled
@bishawjit-das
bishawjit-das / .buildpacks
Last active April 5, 2020 08:50
Dokku Static Site configuration
https://github.com/heroku/heroku-buildpack-nodejs
https://github.com/dokku/buildpack-nginx
# Install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install composer
brew install homebrew/php/composer
### PHPCS
composer global require "squizlabs/php_codesniffer=*"
# Add to your .bash_profile
@bishawjit-das
bishawjit-das / is-private-mode.js
Created January 1, 2020 06:03 — forked from jherax/is-private-mode.js
Detect if the browser is running in Private mode (Promise based)
// uncomment if you are transpiling with Babel + Webpack
// const { window, document } = global;
/**
* Lightweight script to detect whether the browser is running in Private mode.
* @returns {Promise}
*
* Live demo:
* @see http://live.datatables.net/piduzelo/1
*
<script>
async function start() {
if ('storage' in navigator && 'estimate' in navigator.storage) {
const {usage, quota} = await navigator.storage.estimate();
console.log(`Using ${usage} out of ${quota} bytes.`);
if(quota < 120000000){
alert('We see you! You are incognito!')
console.log('Incognito')
} else {
@bishawjit-das
bishawjit-das / ID.js
Created November 28, 2019 08:27
ID - a unique ID/name generator for JavaScript
// Generate unique IDs for use as pseudo-private/protected names.
// Similar in concept to
// <http://wiki.ecmascript.org/doku.php?id=strawman:names>.
//
// The goals of this function are twofold:
//
// * Provide a way to generate a string guaranteed to be unique when compared
// to other strings generated by this function.
// * Make the string complex enough that it is highly unlikely to be
// accidentally duplicated by hand (this is key if you're using `ID`
$to = date('Y-m-d H:i:s');
$from = date('Y-m-d H:i:s', strtotime('-24 hours', strtotime($to)));
$from = gmdate('Y-m-d\TH:i:s\Z', strtotime($from));
$to = gmdate('Y-m-d\TH:i:s\Z', strtotime($to));