Skip to content

Instantly share code, notes, and snippets.

Avatar
🟨
getting things done 💪🏻

Stefan Natter natterstefan

🟨
getting things done 💪🏻
View GitHub Profile
View esm-package.md

Pure ESM package

The package linked to from 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.
@azlen
azlen / bulletpaths.js
Last active Aug 14, 2022
All Paths Lead to Roam
View bulletpaths.js
/*
* credit to Dhrumil Shah (@wandcrafting) and Robert Haisfield (@RobertHaisfield)
* for the original concept which was part of their RoamGames submission
* and can be found at: https://www.figma.com/file/5shwLdUCHxSaPNEO7pazbe/
*
*/
/* ======= OPTIONS ======== */
/* note: if you change these, reload the page to see the effect */
View showFirstCellInGoogleSheetAsiOSWidget.js
// Modified from @mutsuda's https://medium.com/@mutsuda/create-an-ios-widget-showing-google-spreadsheets-data-856767a9447e
// by @levelsio
// HOW TO
// 1) Make a Google Sheet, we'll pull the first cell e.g. A1
// 2) Publish your Google Sheet, File -> Publish To Web
// 3) Copy the SHEET_ID in the URL, put it in here below:
const endpoint = "https://spreadsheets.google.com/feeds/cells/SHEET_ID/1/public/full?alt=json"
// 4) Install Scriptable @ https://apps.apple.com/us/app/scriptable/id1405459188
// 5) Copy this entire script in to Scriptable (tip: you can send it to your iPhone via Whatsapp/Messenger/Telegram etc)
@ottsch
ottsch / add_favicons.js
Last active Jul 16, 2022
Add favicon to links in Roam Research
View add_favicons.js
new MutationObserver(() => {
let filtered = Array.prototype.filter.call(
document.querySelectorAll(".roam-body a"),
(a) => {
return a.hostname && !a.hostname.includes("roamresearch.com");
}
);
Array.prototype.forEach.call(filtered, (a) => {
if (a.text == "*") {
a.style.background = `url(https://www.google.com/s2/favicons?sz=16&domain=${a.hostname}) right center no-repeat`;
@lukasender
lukasender / kill-coreaudiod.sh
Created Feb 18, 2020
macOS Catalina: Kill Audio Service "coreaudiod"
View kill-coreaudiod.sh
function killSound() {
# log coreaudiod process stats
ps aux | grep -e '^_coreaudiod.*/usr/sbin/coreaudiod$'
# grab the coreaudiod pid, and kill it.
sudo kill -9 $(ps aux | grep -e '^_coreaudiod.*/usr/sbin/coreaudiod$' | awk '{print $2}')
# wait until restarted
sleep 5
# log coreaudiod process stats again: verify process ID has changed
@levelsio
levelsio / getRandomFollower.php
Created Jan 11, 2020
get random Twitter follower from your exported followers.js
View getRandomFollower.php
<?
// str_replace removes the JS part and makes it into a normal JSON file
$followers=json_decode(str_replace('window.YTD.follower.part0 = ','',file_get_contents(__DIR__.'/followers.js')),true);
echo "\n\n";
echo number_format(count($followers)).' followers';
echo "\n\n";
@danielmconrad
danielmconrad / unifi-pi.md
Last active Jul 10, 2022
Installing Unifi Controller + Pi-hole on a Raspberry Pi
View unifi-pi.md

Installing Unifi Controller + Pi-hole

Update Packages

sudo rpi-update
sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get autoremove && sudo apt-get autoclean
sudo apt-get install vim -y
@rstacruz
rstacruz / README.md
Last active Feb 13, 2022
Setting up Babel and TypeScript
View README.md

Install Babel 7 and TypeScript

yarn add --dev \
  @babel/core \
  @babel/cli \
  @babel/preset-env \
  @babel/preset-typescript \
  typescript
@d4rekanguok
d4rekanguok / webpack.config.js
Last active Feb 13, 2020
Config Storybook to avoid conflicts with SVGR
View webpack.config.js
const path = require('path');
const pathToInlineSvg = path.resolve(__dirname, '../resources/icons');
module.exports = (_, _, defaultConfig) => {
const rules = defaultConfig.module.rules;
// modify storybook's file-loader rule to avoid conflicts with svgr
const fileLoaderRule = rules.find(rule => rule.test.test('.svg'));
fileLoaderRule.exclude = pathToInlineSvg;
@ademilter
ademilter / .storybook
Last active Sep 7, 2021
postcss config for storybook
View .storybook
- webpack.config.js
- postcss.config.js
- config.js
- addons.js