Skip to content

Instantly share code, notes, and snippets.

View TenType's full-sized avatar

Max Wen TenType

  • Carnegie Mellon University
  • Pittsburgh, PA
  • 19:17 (UTC -04:00)
View GitHub Profile
@TenType
TenType / tutorial.md
Created February 24, 2022 02:43
Python's __repr__ in NodeJS (custom class logging)

The Problem

Consider the following piece of JavaScript code:

class User {
    username = 'bob';
    followers = [
        { username: 'foo', followers: [
            { username: 'bar', followers: [] },
            { username: 'baz', followers: [] },
            { username: 'qux', followers: [] },
@TenType
TenType / environment.d.ts
Last active February 23, 2022 18:32
Add types to environmental variables in NodeJS
/**
* Add the following lines of code in a file called `environment.d.ts` to enable types for environmental variables!
*/
declare global {
namespace NodeJS {
interface ProcessEnv {
// Add your types here
// Examples:
// readonly TOKEN: string,
// readonly ENVIRONMENT: "dev" | "stage" | "prod"