Skip to content

Instantly share code, notes, and snippets.

View MichielDeMey's full-sized avatar
Always available for a coffee

Michiel De Mey MichielDeMey

Always available for a coffee
View GitHub Profile
@baker-ling
baker-ling / email_regex_rfc6531.md
Last active December 11, 2023 12:53
Email Regex (RFC 6531)
@sindresorhus
sindresorhus / esm-package.md
Last active July 22, 2024 15:39
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.
@claus
claus / _app.js
Created May 14, 2020 05:35
Restore scroll position after navigating via browser back/forward buttons in Next.js
import useScrollRestoration from "utils/hooks/useScrollRestoration";
const App = ({ Component, pageProps, router }) => {
useScrollRestoration(router);
return <Component {...pageProps} />;
};
export default App;
@patmigliaccio
patmigliaccio / now-secrets-json.js
Created May 12, 2019 01:23
Adds secret keys from local JSON files as Base64 to `now` secrets.
const fs = require('fs');
const GOOGLE_APPLICATION_CREDENTIALS = 'keys/google_application_credentials.json';
/**
* Adds secret keys from local JSON files as Base64 to `now` secrets.
*
* e.g. `node now-secrets-json.js'
*/
function main() {
@juliendargelos
juliendargelos / imagemagick-trim-transparent.sh
Last active October 23, 2023 02:31
Imagemagick command that trims transparent pixels from an image.
convert input.png -trim +repage output.png
@bojand
bojand / index.md
Last active May 16, 2022 19:32
gRPC benchmarks Go & Node.js
@bnoordhuis
bnoordhuis / bytestokey.js
Created November 29, 2017 22:55
Compute key+IV from passphrase (createCipher to createCipheriv migration script)
// Copyright (c) 2017, Ben Noordhuis <info@bnoordhuis.nl>
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// 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
@epixoip
epixoip / 8x1080.md
Last active July 17, 2024 08:17
8x Nvidia GTX 1080 Hashcat Benchmarks
@plurch
plurch / upsert.js
Created March 2, 2016 05:29
PostgreSQL 9.5 Upsert using Knex.js
exports.knex = require('knex')({
client: 'pg',
connection: {
host : '127.0.0.1',
user : 'your_database_user',
password : 'your_database_password',
database : 'myapp_test'
}
});
@mat
mat / Readme.markdown
Last active February 19, 2024 07:46
apple-app-site-association —with examples

“apple-app-site-association” file

One file for each domain, both www.example.com and example.com need separate files:

{
    "applinks": {
        "apps": [],
        "details": {
 "9JA89QQLNQ.com.apple.wwdc": {