Skip to content

Instantly share code, notes, and snippets.

View christianhaller3000's full-sized avatar
🧶

Christian Haller christianhaller3000

🧶
View GitHub Profile
@sindresorhus
sindresorhus / esm-package.md
Last active April 26, 2024 03:53
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.
@jzaefferer
jzaefferer / check-packages.js
Created February 18, 2021 15:20
Automatically check if installed packages are up-to-date, before start and lint scripts, and on `git pull`; MIT License, Copyright Jörn Zaefferer
#!/usr/bin/env node
//@ts-check
const { execSync } = require('child_process')
const mainPackage = require('../package.json')
const packageLock = require('../package-lock.json')
const outdated = []
Object.keys(mainPackage.dependencies)
.concat(Object.keys(mainPackage.devDependencies))
.forEach(packageName => {
try {
@tkadlec
tkadlec / perf-diagnostics.css
Last active June 8, 2023 17:47
CSS used to highlight potential performance issues
:root {
--violation-color: red; /* used for clear issues */
--warning-color: orange; /* used for potential issues we should look into */
}
/* IMAGES */
/*
* Lazy-Loaded Images Check
* ====
@marco79cgn
marco79cgn / dm-toilet-paper.js
Last active February 29, 2024 17:35
iOS Widget, das die Anzahl an Klopapier Packungen in deiner nächsten dm Drogerie anzeigt (für die scriptable.app)
// dm Klopapier Widget
//
// Copyright (C) 2020 by marco79 <marco79cgn@gmail.com>
//
// Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
// IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
@IanColdwater
IanColdwater / twittermute.txt
Last active April 22, 2024 17:26
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
set -l data_status (curl -s https://iceportal.de/api1/rs/status)
set -l data_trip (curl -s https://iceportal.de/api1/rs/tripInfo/trip)
# next stop
echo  (echo $data_trip | jq -r '([ .trip.stops[] | select(.info.passed==false) ]
| first).station.name')
# train number
echo  (echo $data_trip | jq -r '"\(.trip.trainType)-\(.trip.vzn)"')
# speed
echo speed (echo $data_status | jq -r '"\(.speed) km/h"')
@zkat
zkat / index.js
Last active March 10, 2024 14:32
npx is cool
#!/usr/bin/env node
console.log('yay gist')