Skip to content

Instantly share code, notes, and snippets.

View jeongsd's full-sized avatar
🎯
Focusing

Jeong Seong Dae jeongsd

🎯
Focusing
View GitHub Profile
@kewlbear
kewlbear / webkit-ios-xcode.md
Last active January 18, 2023 12:22
build webkit for iOS using Xcode
@hsablonniere
hsablonniere / EXPLAINER.md
Last active November 15, 2021 21:19
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 ;-)

Context

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
mape / apmPatchPrisma.ts
Last active October 20, 2021 20:26
Elastic APM node client instrumenting Prisma 2 queries
import { condensePrismaQuery } from './utils';
// Screenshot of a trace sample: https://i.imgur.com/XuhuQFq.png
// Service: https://www.elastic.co/apm
// Node module: https://github.com/elastic/apm-agent-nodejs
// Prisma: https://www.prisma.io/
// Using "@prisma/client": "dev"
// Thanks to https://github.com/prisma/prisma/pull/2902
@rstacruz
rstacruz / README.md
Last active January 17, 2024 22:27
Setting up Babel and TypeScript

Install Babel 7 and TypeScript

yarn add --dev \
  @babel/core \
  @babel/cli \
  @babel/preset-env \
  @babel/preset-typescript \
  typescript
@mhaagens
mhaagens / authentication_middleware.js
Last active April 22, 2020 10:14
Auth middleware
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
sturmenta / firestore2json.js
Last active October 28, 2022 19:03
firestore to json & json to firestore
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
jacob-beltran / requestAnimationFrame.js
Last active April 17, 2020 04:05
React Performance: requestAnimationFrame Example
// How to ensure that our animation loop ends on component unount
componentDidMount() {
this.startLoop();
}
componentWillUnmount() {
this.stopLoop();
}
- 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.
@dwilkie
dwilkie / docker-cheat-sheat.md
Last active January 18, 2024 10:56
Docker Cheat Sheet

Build docker image

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

View running processes

@chodorowicz
chodorowicz / toggle.js
Last active February 15, 2021 21:23
lodash toggle array element
/**
* descructive
* https://github.com/lodash/lodash/issues/1677
*/
function toggle(collection, item) {
var idx = _.indexOf(collection, item);
if(idx !== -1) {
collection.splice(idx, 1);
} else {
collection.push(item);