Skip to content

Instantly share code, notes, and snippets.

View epatrasc's full-sized avatar
:octocat:
Coding

Emilian Patrasc epatrasc

:octocat:
Coding
View GitHub Profile
@khalidx
khalidx / node-typescript-esm.md
Last active June 13, 2024 12:39
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

@epatrasc
epatrasc / gs-pull-parallel
Last active February 15, 2023 10:21
Pull repositories from a monorepo in parallel
#!/bin/bash
PARALLEL=${1:-5}
directories=()
for dir in */ ; do
if [ -e "$dir/.git" ] ; then
directories+=("$dir")
fi
done
@sindresorhus
sindresorhus / esm-package.md
Last active June 19, 2024 03:43
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.
@nikitavoloboev
nikitavoloboev / inoreader.xml
Last active December 18, 2022 16:17
Inoreader RSS subscriptions exported. Can be imported into RSS feed reader of your choice. https://wiki.nikitavoloboev.xyz/research/blogs
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>Subscriptions of nikita.voloboev from Inoreader [https://www.inoreader.com]</title>
</head>
<body>
<outline text="1." title="1.">
<outline text="langui.sh" title="langui.sh" type="rss" xmlUrl="https://langui.sh/feed.xml" htmlUrl="https://langui.sh/"/>
<outline text="Apple Machine Learning Journal" title="Apple Machine Learning Journal" type="rss" xmlUrl="https://machinelearning.apple.com/feed.xml" htmlUrl="https://machinelearning.apple.com/"/>
<outline text="knolleary" title="knolleary" type="rss" xmlUrl="https://knolleary.net/feed/" htmlUrl="https://knolleary.net/"/>
@progging
progging / groupByMultipleProps.js
Created May 22, 2019 08:10
Group by multiple properties using lodash
const items = [
{ key1: "el200", key2: "id001", value: "bulb tumeric hell of hot chicken" },
{ key1: "el200", key2: "id001", value: "iceland shaman fashion axe squid vice" },
{ key1: "el200", key2: "id001", value: "pin venmo letterpress cloud bread" },
{ key1: "el400", key2: "id002", value: "YOLO flexitarian, swag sriracha" },
{ key1: "el500", key2: "id002", value: "health goth chillwave" }
];
const grouped = _.groupBy(items, item => `"${item.key1}+${item.key2}"`);
console.log(grouped);
@frankfaustino
frankfaustino / composing.software.md
Last active March 3, 2023 06:20
Eric Elliot: Composing Software Series

Eric Elliott: Composing Software

git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done
@anvaka
anvaka / 00.Intro.md
Last active June 4, 2024 13:48
npm rank

npm rank

This gist is updated daily via cron job and lists stats for npm packages:

  1. Top 1,000 most depended-upon packages
  2. Top 1,000 packages with largest number of dependencies
  3. Top 1,000 packages with highest PageRank score