Skip to content

Instantly share code, notes, and snippets.

@sindresorhus
sindresorhus / esm-package.md
Last active May 18, 2024 09:04
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.
@Gelmo
Gelmo / nowplaying.html
Last active April 19, 2022 14:09
Now Playing overlay for Pretzel | Single file
<!DOCTYPE html>
<!-- Notes:
- This is a slight adjustment to Zyphen's Now Playing overlay, available at https://obsproject.com/forum/resources/zyphens-now-playing-overlay.1026/
- Save this Gist anywhere you like, in a file with the extension ".html"
- In Pretzel, go to Settings > FILE OUTPUT
- Enable "Save Album Cover to file" and save the file in the same directory as the html file you saved saved earlier
- The file name must be album.jpg
- Enable "Save Now Playing JSON Data to file" and save the file in the same directory as the html file you saved saved earlier
- The file name must be nowplaying.json
@xiCO2k
xiCO2k / nginx-rtmp-stream-multi-debian-18.md
Last active March 27, 2024 02:44
RTMP Server to Stream to Facebook, Youtube, Instagram
apt install nginx
apt install libnginx-mod-rtmp
apt install ffmpeg
apt install stunnel4

vim /etc/nginx/nginx.conf

  • Remove http {} and mail {}
@vegather
vegather / BlurryOverlayView.swift
Last active February 26, 2024 16:06
A simple view to animate in and out a blurry overlay. Use .blurIn() and .blurOut() to animate the blur. User interaction is passed through when the view is not blurry. NOTE: If you use storyboards, you need to drag out a UIVisualEffectView and set the class. It doesn't work if you drag out a plain old UIView.
class BlurryOverlayView: UIVisualEffectView {
private var animator: UIViewPropertyAnimator!
private var delta: CGFloat = 0 // The amount to change fractionComplete for each tick
private var target: CGFloat = 0 // The fractionComplete we're animating to
private(set) var isBlurred = false
private var displayLink: CADisplayLink!
override init(effect: UIVisualEffect?) {
super.init(effect: effect)
setup()
@kdzwinel
kdzwinel / main.js
Last active May 2, 2024 05:30
List all undefined CSS classes
/*
This script attempts to identify all CSS classes mentioned in HTML but not defined in the stylesheets.
In order to use it, just run it in the DevTools console (or add it to DevTools Snippets and run it from there).
Note that this script requires browser to support `fetch` and some ES6 features (fat arrow, Promises, Array.from, Set). You can transpile it to ES5 here: https://babeljs.io/repl/ .
Known limitations:
- it won't be able to take into account some external stylesheets (if CORS isn't set up)
- it will produce false negatives for classes that are mentioned in the comments.