Skip to content

Instantly share code, notes, and snippets.

View srsajjad's full-sized avatar
🌱
Tinkering

Saidur Rahman srsajjad

🌱
Tinkering
View GitHub Profile

Clerk Flutter: Force Session Token Refresh

Key point: Do not cache session tokens. Fetch a fresh token right before each API call, and when you update the user externally, reload the User and refresh the token.

References: Force a session token refresh · clerk_flutter repo


Option 1 — Get a fresh token per request (http)

Arguments

1. The "Hard Stuff" Still Needs Factories

Planes, rockets, cars, ships, clothes, medical devices — all physical goods that require industrial-scale production.

Even your smartphone (the symbol of miniaturization) requires giant semiconductor fabs that cost $20–$30 billion each. That's not garage tinkering — it's industrial might.

"You can't 3D-print a Boeing 787 in your basement." Industrial capacity still matters.

// first
const moveZeros = (nums) => {
// const nums = [0,1,0,3,12]
return nums;
};
// second - done
const intersectionOfTwoArrays = (nums1, nums2) => {
const set1 = new Set(nums1);
const set2 = new Set(nums2);
<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

import React, { useEffect } from 'react'
import L from 'leaflet'
import { GestureHandling } from 'leaflet-gesture-handling'
import 'leaflet/dist/leaflet.css'
import 'leaflet-gesture-handling/dist/leaflet-gesture-handling.css'
const Map = props => {
let { lat, lng } = props
useEffect(
// using snackbar with Redux
// create a feature component for Notification
// notification - action + container + reducer
// the action is exported
// so this can be dispatched from anywhere
// the container will be mounted inside the root component
// the root component will be wrapped with SnackbarProvider from notistack