Skip to content

Instantly share code, notes, and snippets.

@khalidx
khalidx / node-typescript-esm.md
Last active April 15, 2025 14:15
A Node + TypeScript + ts-node + ESM experience that works.

The experience of using Node.JS with TypeScript, ts-node, and ESM is horrible.

There are countless guides of how to integrate them, but none of them seem to work.

Here's what worked for me.

Just add the following files and run npm run dev. You'll be good to go!

package.json

@smuuf
smuuf / a2manage.sh
Created January 28, 2022 10:19
a2enmod and a2dismod for Alpine
#!/bin/sh
# Usage:
# ./a2manage.sh a2dismod proxy.*
# ./a2manage.sh a2enmod proxy proxy_fcgi ssl
MODS_A_CONF_PATH="/etc/apache2/*.conf"
MODS_B_CONF_PATH="/etc/apache2/conf.d/*.conf"
function a2enmod {
@sindresorhus
sindresorhus / esm-package.md
Last active April 25, 2025 07:50
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@akinncar
akinncar / SnackBarContext.tsx
Created February 1, 2021 16:33
SnackBar Material UI Context Typescript Boilerplate
import { Snackbar } from '@material-ui/core';
import { Alert, Color } from '@material-ui/lab';
import React, { createContext, useContext } from 'react';
type SnackBarContextActions = {
showSnackBar: (text: string, typeColor: Color) => void;
};
const SnackBarContext = createContext({} as SnackBarContextActions);
@kennethnwc
kennethnwc / .dockerignore
Last active July 28, 2024 08:09
My docker-compose with nextjs and nginx
.next/
node_modules/
Dockerfile
yarn-error.log
.dockerignore
.git
.gitignore
@eduncan911
eduncan911 / plex.sh
Last active July 6, 2023 20:06
Plex + Docker + Updated Chromecast Ultra Config
#!/usr/bin/env bash
#
# Plex's profile for Chromecast is too conservative and only plays 1080p on
# the Chromecast Ultra UHD device (4k).
#
# This script will download an updated Chromecast definition and start a Plex
# docker container, binding a few local paths of where you run this script.
#
# You may want to refer to the Official Plex Docker repository and read the
# README text: https://github.com/plexinc/pms-docker
@nicolasdao
nicolasdao / webpack.md
Last active June 22, 2024 02:56
Basic damn Webpack config for simple transpilation ES6 to ES5

Install

npm install -D acorn babel-loader @babel/core @babel/preset-env babel-polyfill webpack webpack-cli uglifyjs-webpack-plugin --save-dev

webpack-cli and acorn are dependencies that you, unfortunately, have to install if you want to run this god damn thing without any obscure warnings or errors.

Build

Configure Webpack

@goyalmohit
goyalmohit / compare-database-using-liquibase
Last active May 19, 2022 16:22
Liquibase command to compare databases
liquibase
--driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
--classpath="C:\\Program Files\\Microsoft JDBC Driver 6.0 for SQL Server\\sqljdbc_6.0\\enu\\jre8"
--url="jdbc:sqlserver://localhost:1433;databaseName=AdventureWorksProd;integratedSecurity=false;"
--username=liquibase
--password=liquibase@123
--logLevel=debug
diff
--referenceUrl="jdbc:sqlserver://localhost:1433;databaseName=AdventureWorks2017;integratedSecurity=false;"
--referenceUsername=liquibase
@jwill9999
jwill9999 / README.md
Last active February 19, 2025 03:36
asp.net core