Skip to content

Instantly share code, notes, and snippets.


Jeong Seong Dae jeongsd

View GitHub Profile
hsablonniere /
Last active Nov 15, 2021
Explainer for my rollup plugin idea about import.meta.url with assets

Explainer for my rollup plugin idea

The "i-prefer-import-meta-url-over-using-esm-import-to-get-a-relative-file-url" plugin ;-)


In my components library, I have SVG images. I used them with <img> tags in my components and to get the proper relative URL, I use new URL('../assets/image.svg', import.meta.url').href.

To make this work in a rollup build, you need to:

mape / apmPatchPrisma.ts
Last active Oct 20, 2021
Elastic APM node client instrumenting Prisma 2 queries
View apmPatchPrisma.ts
import { condensePrismaQuery } from './utils';
// Screenshot of a trace sample:
// Service:
// Node module:
// Prisma:
// Using "@prisma/client": "dev"
// Thanks to
rstacruz /
Last active Feb 13, 2022
Setting up Babel and TypeScript

Install Babel 7 and TypeScript

yarn add --dev \
  @babel/core \
  @babel/cli \
  @babel/preset-env \
  @babel/preset-typescript \
View authentication_middleware.js
import jwt from "jsonwebtoken";
import User from "@server/models/user_model";
const PRODUCTION = process.env.NODE_ENV === "production";
export default (options) => async (req, res, next) => {
const refreshToken = req.cookies["refresh_token"];
const accessToken = req.cookies["access_token"];
const csrfHeader = req.get("X-Csrf-Token");
sturmenta / firestore2json.js
Last active Aug 4, 2022
firestore to json & json to firestore
View firestore2json.js
const admin = require('firebase-admin');
const fs = require('fs');
const serviceAccount = require('../../../../../../Private/myschool-data_transfer-key.json');
admin.initializeApp({ credential: admin.credential.cert(serviceAccount) });
const schema = require('./schema').schema;
const firestore2json = (db, schema, current) => {
jacob-beltran / requestAnimationFrame.js
Last active Apr 17, 2020
React Performance: requestAnimationFrame Example
View requestAnimationFrame.js
// How to ensure that our animation loop ends on component unount
componentDidMount() {
componentWillUnmount() {
- Inexplicable perversity of human nature.
- The clever machinations of MongoDB's marketing people.
- The AGPL license killed it.
- We spent too long development before monetizing.
- Bad performance.
- Numeric types limited to a 64-bit `float`.
- Great product, but didn't/couldn't translate to revenue.
- Bad business model.
- Failure in timezones/timestamp nuances.

Build docker image

$ cd /path/to/Dockerfile
$ sudo docker build .

View running processes

chodorowicz / toggle.js
Last active Feb 15, 2021
lodash toggle array element
View toggle.js
* descructive
function toggle(collection, item) {
var idx = _.indexOf(collection, item);
if(idx !== -1) {
collection.splice(idx, 1);
} else {
sloanwolf / ReactNativeChatScreenExample.js
Last active Feb 8, 2019
React-Native Chat screen with bottom TextInput
View ReactNativeChatScreenExample.js
* Below is a bare functioning example of how I made a React-Native Chat messaging component that shifts the input up when
* the keyboard is active, and scrolls back down when the keyboard is inactive from a TextInput blur.
* The only thing I haven't been able to figure out yet is getting the ListView to render from the bottom, not sure if it's
* possible yet via styles.
* NOTE: This uses from iOS-only properties