Skip to content

Instantly share code, notes, and snippets.

View jbenner-radham's full-sized avatar

James Benner jbenner-radham

View GitHub Profile
@amitmerchant1990
amitmerchant1990 / console.js
Created January 24, 2025 08:07
Calculate used localStorage size for a website
let totalSize = 0;
for (let key in localStorage) {
if (localStorage.hasOwnProperty(key)) {
let keySize = new Blob([key]).size; // Size of the key
let valueSize = new Blob([localStorage[key]]).size; // Size of the value
totalSize += keySize + valueSize;
}
}
@khalidx
khalidx / node-typescript-esm.md
Last active April 15, 2025 14:15
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

@NorbiPeti
NorbiPeti / IntelliJFlatpak.md
Last active April 16, 2025 23:17
IntelliJ IDEA Flatpak Setup Guide

IntelliJ IDEA Flatpak Setup Guide

In this guide I collect all the things I had to manually set up after installing IntelliJ using Flatpak on Linux. Also mostly applicable to other JetBrains IDEs like PHPStorm, WebStorm, Rider, PyCharm etc.

Java versions

Flatpak uses an isolated environment to install the latest version of (usually graphical) applications without having to rely on installed system libraries and such with varying versions.

@Myndex
Myndex / GitHubFlavoredMarkdown.md
Last active April 14, 2025 09:18 — forked from joshuapekera/markdown
GitHub Flavored Markdown Cheat Sheet
@sindresorhus
sindresorhus / esm-package.md
Last active April 18, 2025 01:47
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.
@ChristopherA
ChristopherA / brew-bundle-brewfile-tips.md
Last active April 16, 2025 15:50
Brew Bundle Brewfile Tips

Brew Bundle Brewfile Tips

Copyright & License

Unless otherwise noted (either in this file or in a file's copyright section) the contents of this gist are Copyright ©️2020 by Christopher Allen, and are shared under spdx:Creative Commons Attribution Share Alike 4.0 International (CC-BY-SA-4.) open-source license.

Sponsor

If you more tips and advice like these, you can become a monthly patron on my GitHub Sponsor Page for as little as $5 a month; and your contributions will be multipled, as GitHub is matching the first $5,000! This gist is all about Homebrew, so if you like it you can support it by donating to them or becoming one of their Github Sponsors.

@aelbore
aelbore / esm-cjs-modules.md
Last active January 20, 2025 06:34
Publish your npm package as ES Module, and backward compatibility CommonJS

Create your library

  • Initialize project npm init -y
  • Create esm module ./src/esm/my-lib.js
    function addNumber(value, value2) {
      return value + value2;
    }
    
    export { addNumber };
@anukmd
anukmd / PY0101EN-2-2-Lists.ipynb
Created January 10, 2020 22:19
Created on Cognitive Class Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mcandre
mcandre / dump-certs.sh
Created January 10, 2020 22:10
Dump a website's certificate chain
openssl s_client -host google.com -port 443 -prexit -showcerts
@mahyahemmat
mahyahemmat / PY0101EN-2-4-Sets.ipynb
Created January 10, 2020 21:54
Created on Cognitive Class Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.