Skip to content

Instantly share code, notes, and snippets.

joanna-liana / afterEnv.ts
Last active May 28, 2024 18:51
Jest + TypeORM + TestContainers
import { setupTypeOrmTestConnection } from '../integrationSetup';
beforeAll(async () => {
console.log('AFTER ENV SETUP START');
global.testConn = await setupTypeOrmTestConnection(+process.env.TEST_PG_PORT);
console.log('AFTER ENV SETUP DONE');
afterAll(async () => {
azu / TypeScriptの設定の良し悪し.md
Last active April 1, 2024 10:23

tsconfig.json の設定についてのメモ書きです。


target は 変換後のコードのECMAScriptバージョンを指定する たとえば、Node.js 14はES2020をサポートしている。そのため、Node.js 14向けのコード(サーバなど)ならtarget: "ES2020"を指定することで、余計なTranspileが省かれててコードサイズや実行時間が最適化される。

FocusThen / useState.js
Created February 21, 2021 20:44
React useState from scratch
import React from 'react';
import ReactDOM from 'react-dom';
let callCount = -1
let states = []
function useState(initValue) {
const id = ++callCount
if (states[id]) return states[id]
jakub-g /
Last active February 22, 2023 02:33
Mapping Safari releases to Safari TP versions
ozluy / .eslintrc
Last active April 10, 2022 05:16
Nextjs Eslint
"env": {
"browser": true,
"es6": true,
"commonjs": true
"plugins": ["react"],
"extends": [
swyxio /
Last active February 8, 2024 22:30
Learn In Public - 7 opinions for your tech career

2019 update: this essay has been updated on my personal site, together with a followup on how to get started

2020 update: I'm now writing a book with updated versions of all these essays and 35 other chapters!!!!

1. Learn in public

If there's a golden rule, it's this one, so I put it first. All the other rules are more or less elaborations of this rule #1.

You already know that you will never be done learning. But most people "learn in private", and lurk. They consume content without creating any themselves. Again, that's fine, but we're here to talk about being in the top quintile. What you do here is to have a habit of creating learning exhaust. Write blogs and tutorials and cheatsheets. Speak at meetups and conferences. Ask and answer things on Stackoverflow or Reddit. (Avoid the walled gardens like Slack and Discourse, they're not public). Make Youtube videos

bsouthga /
Last active July 14, 2022 02:54
WeakMap + Redux

Combining Weakmap + Redux for fun and profit.


Lets say we have a large Redux State object which looks like this...

interface State {
  stockMarketData: {
 [stockTicker: string]: {
harshavardhana /
Last active May 13, 2024 15:03 — forked from koolhead17/gist:4b8dd8d95ec86368634693cf9ad9391c
How to configure static website using Nginx with MinIO ?

How to configure static website using Nginx with MinIO ?

1. Install nginx

2. Install minio

3. Install mc client

4. Create a bucket:

$ mc mb myminio/static
Bucket created successfully ‘myminio/static’.
serithemage /
Last active June 3, 2024 08:28
AWS 공인 개발자 - 어소시에이트 수험 가이드
tizmagik / getLastInMap.js
Created August 13, 2016 03:22
ES6 Last Item in Map()
// Since ES6 Map()'s' retain their order of insertion, it can sometimes be useful to get the last item or value inserted:
export const getLastItemInMap = map => Array.from(map)[map.size-1]
export const getLastKeyInMap = map => Array.from(map)[map.size-1][0]
export const getLastValueInMap = map => Array.from(map)[map.size-1][1]
// Obviously getLastKey and getLastValue can reuse getLastItem, but for maximum portability I opted for verbosity.