Skip to content

Instantly share code, notes, and snippets.

View tuanlc's full-sized avatar
🌀️
Focusing

Cong Tuan Le tuanlc

🌀️
Focusing
View GitHub Profile
@tuanlc
tuanlc / Unnest-flat-nested-arrays.ts
Created August 19, 2022 10:17
Unnest/flat nested arrays
export default function flatNestedArrays(array: unknown[]): unknown[] {
let output: unknown[] = [];
let stack = [...array];
handleFlatingNestedArrays({ stack, output })
return output.reverse();
}
@tuanlc
tuanlc / Number_Of_Carries_Solution_Javascript.js
Created August 3, 2022 02:59
Solution for number of carries when sum 2 numbers in Javascript
numberOfCarryOperations(1234, 5678); //2
numberOfCarryOperations(5555, 5555); //4
numberOfCarryOperations(123, 456); //0
function numberOfCarryOperations(a, b) {
const revertedArrayOfDigitOfA = pushNumberToStack(a).reverse();
const revertedArrayOfDigitOfB = pushNumberToStack(b).reverse();
const numberOfCaries = calculateNumberOfCarryOperations({
arrayOfDigitA: revertedArrayOfDigitOfA,
@tuanlc
tuanlc / minio-docker-compose.md
Created December 28, 2021 04:16
run minio service in docker compose
s3-storage:
  image: minio/minio:RELEASE.2021-12-20T22-07-16Z
  container_name: s3-storage
  ports:
    - 9000:9000
    - 9001:9001
  command: server /data --console-address ":9001"
  environment:
MINIO_ROOT_USER: minio
const companySchema = new Schema(
  {
    code: {
      type: String,
      index: true,
      unique: true,
    },
    location: String;
 name: String,
> db.companies.getIndexes()
[
        {
                "v" : 2,
                "key" : {
                        "_id" : 1
                },
                "name" : "_id_",
 "ns" : "project-name.companies"
const companySchema = new Schema(
  {
    location: String;
    name: String,
  }
);
const userSchema = new Schema(
  {
    email: {
      type: String,
      index: true,
      unique: true,
    },
    name: String,
 }
.
β”œβ”€β”€ package.json
β”œβ”€β”€ package-lock.json
β”œβ”€β”€ README.md
β”œβ”€β”€ src
β”‚   β”œβ”€β”€ application
β”‚   β”‚   β”œβ”€β”€ auth
β”‚   β”‚   β”‚   └── index.ts
β”‚ β”‚ β”œβ”€β”€ graphql
src/Student.ts:16:3 - error TS18022: A method cannot be named with a private identifier.

16   #playGame() {
     ~~~~~~~~~


Found 1 error.

error Command failed with exit code 2.
export default class Student {
  name: string;
  email: string;
  #phone: string;
  
  constructor(name: string, email: string, phone: string) {
    this.name = name;
    this.email = email;
 this.#phone = phone;