Skip to content

Instantly share code, notes, and snippets.

View drazik's full-sized avatar

Cyrille Perois drazik

View GitHub Profile
@slavafomin
slavafomin / 00-typescript-esm.md
Last active May 3, 2024 10:42
Using TypeScript with native ESM

Using TypeScript Node.js with native ESM

This reference guide shows how to configure a TypeScript Node.js project to work and compile to to native ESM.

Rationale

CommonJS module system was introduced by the Node.js developers due to the lack of the notion of "modules" in the original JavaScript (ECMAScript) language specification at that time. However, nowadays, ECMAScript has a standard module system called ESM — ECMAScript Modules, which is a part of the accepted standard. This way CommonJS could be considered vendor-specific and obsolete/legacy. Hopefully, TypeScript ecosystem now supports the "new" standard.

So the key benefits are:

@sindresorhus
sindresorhus / esm-package.md
Last active May 4, 2024 15:48
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.
@aanari
aanari / set-alacritty-default.sh
Last active April 29, 2024 16:28
Set Alacritty as Default Terminal Editor (Ubuntu)
sudo update-alternatives --install /usr/bin/x-terminal-emulator x-terminal-emulator $(which alacritty) 50
sudo update-alternatives --config x-terminal-emulator
@akersten
akersten / userChrome.css
Last active February 26, 2024 20:39
userChrome.css to hide Firefox native tab bar and extension sidebar header (for use with TreeStyleTabs)
/*
* about:config -> toolkit.legacyUserProfileCustomizations.stylesheets : True
* about:support -> Profile Folder -> Open Folder
* Create `chrome` direcory
*/
#tabbrowser-tabs {
visibility: collapse !important;
}
@necojackarc
necojackarc / Set up Vim with clipboard on Ubuntu on WSL2.md
Last active December 28, 2023 02:45
Set up Vim on Ubuntu on Windows Subsystem for Linux 2 (WSL2) to share clipboard

This explains how to set up Vim on Ubuntu 18.04 on Windows Subsystem for Linux 2 (WSL2) in order to share the clipboard between Windows and Ubuntu.

Environments

  • Windows 10 Home
  • Ubuntu 18.04 on Windows Subsystem for Linux 2 (WSL2)

Steps

  1. Build Vim with the clipboard option enabled
  2. Set up VcXsrv Windows X Server
@ptbrowne
ptbrowne / rlink.sh
Last active January 21, 2020 09:09
Like yarn link but with rsync/nodemon
@andersevenrud
andersevenrud / alacritty-tmux-vim_truecolor.md
Last active May 3, 2024 08:11
True Color (24-bit) and italics with alacritty + tmux + vim (neovim)

True Color (24-bit) and italics with alacritty + tmux + vim (neovim)

This should make True Color (24-bit) and italics work in your tmux session and vim/neovim when using Alacritty (and should be compatible with any other terminal emulator, including Kitty).

Testing colors

Running this script should look the same in tmux as without.

curl -s https://gist.githubusercontent.com/lifepillar/09a44b8cf0f9397465614e622979107f/raw/24-bit-color.sh >24-bit-color.sh
@dmccombs
dmccombs / config.fish
Created April 28, 2016 00:59
A simple way to use the GNOME keyring for SSH key managment in fish shell
# Add this to the bottom of your config.fish file
# Set SSH to use Gnome keyring
set -gx SSH_AUTH_SOCK (gnome-keyring-daemon --start | grep "^SSH_AUTH_SOCK" | awk -F "=" '{print $2}')
@iamkirkbater
iamkirkbater / macros.forms.twig
Created April 5, 2016 15:00
Twig Macros for forms. Uses an array of attributes instead of 400 separate parameters for separate values. Also abstracts HTML5 text types for ease of reading in your template files.
{% macro input(name, value, type, attributes) %}
<input name="{{ name }}" type="{{ type }}" value="{{ value }}"{% for attr, value in attributes %} {{ attr }}="{{ value }}"{% endfor %}{% if not attributes.id is defined %} id="{{ name }}"{% endif %}/>
{% endmacro %}
{% macro text(name, value, attributes) %}
{% from _self import input %}
{{ input(name, value, "text", attributes) }}
{% endmacro %}
{% macro password(name, value, attributes) %}
@akella
akella / vertical-and-spread.sass
Last active December 6, 2018 20:59
Justify for inline-block, and vertical-align for inline-block
=justify
text-align: justify
line-height: 0
font-size: 0
text-justify: newspaper
zoom: 1
text-align-last: justify
&:after
content: ""
display: inline-block