Skip to content

Instantly share code, notes, and snippets.

View tanvirstreame's full-sized avatar
💻
Superman

Tanvir Islam Streame tanvirstreame

💻
Superman
View GitHub Profile

Some helpful guidelines for pull requests and code reviews

It's been often said that programming is part art, part science - that because lots of times there's no single, simple solution to a problem; or if there is, we might not know about it. There's also an infamous joke that if there are n developers in the room, then there are n+1 opinions on how things should be done. That being said, here are some guidelines that should prevent friction when submitting or reviewing code.

The most important thing

The code has to work. Unless you open a PR as a work in progress, the code should be built and tested on a device or emulator.

If you have touched the gradle build files and changed build setup, it's useful to test the whole build from scratch (clean build) and all of the types and flavours. If you have touched payments (logic or UI), you should test that it still works correctly, both in test and production builds. If you updated external libraries, test the pertaining features (e.g. if you

@tanvirstreame
tanvirstreame / gist:1b0cc9968d3de40abff2c27d699b0d10
Last active December 9, 2022 20:42
Alternative to npm link is yalc
// Help in developing package locally
// https://medium.com/@sam-king/an-alternative-to-npm-link-cf9ab9408f56
// https://betterprogramming.pub/how-to-create-and-publish-react-typescript-npm-package-with-demo-and-automated-build-80c40ec28aca
npm i yalc -g
yalc publish
yalc add [email protected]
yalc remove [email protected]
<html>
<head>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<style>
thead {
position: sticky;
position: -webkit-sticky;
top: 0;
screen.debug(undefined, Number.POSITIVE_INFINITY);
@tanvirstreame
tanvirstreame / rsa.js
Created August 19, 2022 11:13 — forked from sohamkamani/rsa.js
An example of RSA Encryption implemented in Node.js
const crypto = require("crypto")
// The `generateKeyPairSync` method accepts two arguments:
// 1. The type ok keys we want, which in this case is "rsa"
// 2. An object with the properties of the key
const { publicKey, privateKey } = crypto.generateKeyPairSync("rsa", {
// The standard secure default length for RSA keys is 2048 bits
modulusLength: 2048,
})
@tanvirstreame
tanvirstreame / public_enc_example.sh
Created August 18, 2022 21:54 — forked from thinkerbot/public_enc_example.sh
Public-key encryption example using OpenSSL
#!/bin/bash
#
# Public-Key Encryption and Decryption
# * http://www.openssl.org/
# * http://barelyenough.org/blog/2008/04/fun-with-public-keys/
#
# Mac OS X 10.6.4
# OpenSSL 0.9.8l 5 Nov 2009
# Generate keys
@tanvirstreame
tanvirstreame / rsa.txt
Last active August 19, 2022 10:16
RSA
// Generate private.pem
openssl genrsa -out private.pem 512
// Generate public.pem
openssl rsa -in private.pem -pubout > public.pem
// Encrypt
openssl rsautl -in text.txt -out secret.enc -pubin -inkey public.pem -encrypt
// Decrypt
@tanvirstreame
tanvirstreame / two_pointers.js
Created June 11, 2022 14:04 — forked from scaryguy/two_pointers.js
Two Pointers Technique (in JavaScript)
// This gist is for my YouTube video which I tried to explain Window Sliding Technique.
// You can watch it from here: https://youtu.be/guDU5HnLqAs
// Given a sorted array A (sorted in ascending order), having N integers,
// find if there exists any pair of elements (A[i], A[j]) such that
// their sum is equal to X.
//
// Input: A = [2,3,4,5,6,7,8,9], k= 10
// Output: true
// NOTE: We slightly changed the question and the output in the video. We're returning pair indexes as an array.
mongorestore --uri <link> -d <new-db-name> dump/
@tanvirstreame
tanvirstreame / PurgeCss in Create React App without ejecting
Created May 28, 2022 14:03 — forked from DyadicGit/PurgeCss in Create React App without ejecting
remove unused css (PurgeCss) in Create React App without ejecting
//package.json
{
...
"devDependencies": {
...
"purgecss": "^3.0.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build && npm run purge-css",