Skip to content

Instantly share code, notes, and snippets.

View w3nl's full-sized avatar

Pieter Wigboldus w3nl

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

@sindresorhus
sindresorhus / esm-package.md
Last active June 15, 2024 16:08
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.
@rauchg
rauchg / README.md
Last active January 6, 2024 07:19
require-from-twitter
/**
* Internet of Lego - Train Schedule Display
* This program connects to WiFi, utilizes MQTT and displays the local train schedule on an OLED screen
* The OLED graphics library is slimmed down to only text for memory efficiency
* https://github.com/greiman/SSD1306Ascii
*
* Hardware: Cactus Micro Rev2 - http://wiki.aprbrother.com/wiki/Cactus_Micro_Rev2
* Written by: Cory Guynn with some snippets from public examples ;)
* 2016
*
@starfys
starfys / fisr.js
Last active May 18, 2024 00:09
Fast inverse square root in Javascript
//Based on the fast inverse square root function
// https://en.wikipedia.org/wiki/Fast_inverse_square_root
// Some original comments preserved for humor value
// Designed to try to mimic the original as closely as possible
function Q_rsqrt(number)
{
var i;
var x2, y;
const threehalfs = 1.5;
@ecdundar
ecdundar / copymysql.sh
Last active May 31, 2024 11:36
Copy MySQL Database One Server (Remote) To Another (Local) Server
#!/bin/bash
# copymysql.sh
# GENERATED WITH USING ARTUR BODERA'S SCRIPT
# Source script at: https://gist.github.com/2215200
MYSQLDUMP="/usr/bin/mysqldump"
MYSQL="/usr/bin/mysql"
@hissy
hissy / rscsv-divide-meta-fields.php
Created April 6, 2015 01:29
Divide Meta Fields with Comma (Really Simple CSV Importer add-on)
<?php
/*
Plugin Name: Divide Meta Fields with Comma (Really Simple CSV Importer add-on)
*/
add_filter('really_simple_csv_importer_save_meta', function($meta, $post, $is_update) {
foreach ($meta as $key => $value) {
if (strpos($value, ',') !== false) {
$_value = preg_split("/,+/", $value);
$meta[$key] = $_value;
@brentonstrine
brentonstrine / css-compress.php
Last active December 3, 2019 18:49 — forked from manastungare/css-compress.php
Fix space removal so that it doesn't break space-separated values where the developer used more than one space to separate values.
<?php
/**
* On-the-fly CSS Compression
* Copyright (c) 2009 and onwards, Manas Tungare.
* Creative Commons Attribution, Share-Alike.
*
* In order to minimize the number and size of HTTP requests for CSS content,
* this script combines multiple CSS files into a single file and compresses
* it on-the-fly.
*
@wkjagt
wkjagt / audio-book-reader.md
Last active April 12, 2024 14:18
How I built an audio book reader for my nearly blind grandfather

#How I built an audio book reader for my nearly blind grandfather

Tweet this - Follow me

Last year, when visiting my family back home in Holland, I also stopped by my grand-parents. My grand-father, now 93 years old, had always been a very active man. However, during the presceding couple of months, he'd gone almost completely blind and now spent his days sitting in a chair. Trying to think of something for him to do, I suggested he try out audio books. After finally convincing him -- he said audio books were for sad old people -- that listening to a well performed recording is actually a wonderful experience, I realized the problem of this idea.

####The problem with audio devices and the newly blind. After my first impulse to jump up and go buy him an

@staltz
staltz / introrx.md
Last active June 15, 2024 12:24
The introduction to Reactive Programming you've been missing