Skip to content

Instantly share code, notes, and snippets.

View srsajjad's full-sized avatar
🌱
Tinkering

Saidur Rahman srsajjad

🌱
Tinkering
View GitHub Profile
<link rel="shortcut icon" width=32px>
<canvas style="display: none" id="loader" width="16" height="16"></canvas>
<script>
class Loader {
constructor(link, canvas) {
this.link = link;
this.canvas = canvas;
this.context = canvas.getContext('2d');
this.context.lineWidth = 2;
@srsajjad
srsajjad / node_nginx_ssl.md
Created April 9, 2020 09:31 — 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

const express = require('express');
const app = express();
// Application
app.get('/', function(req, res) {
if (process.env.NODE_ENV === 'development') {
for (var key in require.cache) {
delete require.cache[key];
}
}
@srsajjad
srsajjad / minification.md
Created December 11, 2019 11:12 — forked from gaearon/minification.md
How to Set Up Minification

In production, it is recommended to minify any JavaScript code that is included with your application. Minification can help your website load several times faster, especially as the size of your JavaScript source code grows.

Here's one way to set it up:

  1. Install Node.js
  2. Run npm init -y in your project folder (don't skip this step!)
  3. Run npm install terser

Now, to minify a file called like_button.js, run in the terminal:

@srsajjad
srsajjad / vscode_shortcuts.md
Created November 4, 2019 06:29 — forked from bradtraversy/vscode_shortcuts.md
Helpful shortcuts for VSCode

VSCode Shortcuts

List of helpful shortcuts for faster coding

If you have any other helpful shortcuts, feel free to add in the comments of this gist :)

Official List of all commands

@srsajjad
srsajjad / index.html
Created November 14, 2018 09:26 — forked from jeffposnick/index.html
beforeinstallprompt demo
<html>
<head>
<title>Test</title>
<link rel="manifest" href="manifest.json">
</head>
<body>
<p>
If the <code>beforeinstallprompt</code> event fires, there will be a button displayed allowing
you to use <code>prompt()</code> on the deferred event.
</p>
@srsajjad
srsajjad / firebase-messaging-sw.js
Created November 6, 2018 18:50 — forked from loicginoux/firebase-messaging-sw.js
Adding FCM to an html page to receive notifications and sending then via FCM ruby gem
// [START initialize_firebase_in_sw]
// Give the service worker access to Firebase Messaging.
// Note that you can only use Firebase Messaging here, other Firebase libraries
// are not available in the service worker.
importScripts('https://www.gstatic.com/firebasejs/3.5.2/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/3.5.2/firebase-messaging.js');
// Initialize the Firebase app in the service worker by passing in the
// messagingSenderId.
firebase.initializeApp({
@srsajjad
srsajjad / webdev_online_resources.md
Created July 17, 2018 04:59 — forked from bradtraversy/webdev_online_resources.md
Online Resources For Web Developers (No Downloading)
@srsajjad
srsajjad / ssh.txt
Created July 11, 2018 10:42 — forked from bradtraversy/ssh.md
SSH & DevOps Crash Course Snippets
# Login via SSH with password (LOCAL SERVER)
> ssh [email protected]
# Create folder, file, install Apache (Just messing around)
mkdir test
cd test
touch hello.txt
sudo apt-get install apache2
# Generate Keys
@srsajjad
srsajjad / sample.md
Created March 24, 2018 04:14 — forked from bradtraversy/sample.md
Markdown Cheat Sheet

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6

This text is italic