Skip to content

Instantly share code, notes, and snippets.

View tanvirstreame's full-sized avatar
💻
Superman

Tanvir Islam Streame tanvirstreame

💻
Superman
View GitHub Profile
class User {
constructor(userId, userName) {
this.userId = userId;
this.userName = userName;
}
}
class Post {
constructor(userId, posts) {
this.userId = userId;

Definitely not comprehensive. This is meant to be a basic memory aid with links to get more details. I'll add to it over time.

Install

$ npm install mongoose --save

Connect

const mongoose = require('mongoose');
const arr = [4,2,1,3];
class Node {
constructor(value) {
this.value = value;
this.next = null;
}
}

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

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 example-package@0.0.1
yalc remove example-package@0.0.1
<html>
<head>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/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