Skip to content

Instantly share code, notes, and snippets.

View ewanharris's full-sized avatar

Ewan Harris ewanharris

View GitHub Profile
@sindresorhus
sindresorhus / esm-package.md
Last active November 15, 2024 15:20
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.
@aslafy-z
aslafy-z / add-github-orgs-to-user-meta.js
Last active August 23, 2022 20:59
Auth0 rule to check organization of Github users
// Auth0 custom rule
// Add Github Organizations to the user metadata
//
// This rule need the following configurations values
// AUTH0_DOMAIN_NAME: your auth0 domain name
// MANAGEMENT_CLIENT_ID: your auth0 management api client id
// MANAGEMENT_CLIENT_SECRET: your auth0 management api client secret
//
// You have to create an Management API Application with proper
// scope to allow rule to fetch user organizations.

Quick reference: Math

Data properties

  • Math.E: number ES1

    Euler’s number, base of the natural logarithms, approximately 2.7182818284590452354.

  • Math.LN10: number ES1

@gaearon
gaearon / prepack-gentle-intro-1.md
Last active May 3, 2024 12:56
A Gentle Introduction to Prepack, Part 1

Note:

When this guide is more complete, the plan is to move it into Prepack documentation.
For now I put it out as a gist to gather initial feedback.

A Gentle Introduction to Prepack (Part 1)

If you're building JavaScript apps, you might already be familiar with some tools that compile JavaScript code to equivalent JavaScript code:

  • Babel lets you use newer JavaScript language features, and outputs equivalent code that targets older JavaScript engines.
@jessfraz
jessfraz / boxstarter.ps1
Last active October 8, 2024 17:58
Boxstarter Commands for a new Windows box.
# Description: Boxstarter Script
# Author: Jess Frazelle <[email protected]>
# Last Updated: 2017-09-11
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
# A BoxStarter script for use with http://boxstarter.org/WebLauncher
# Updates a Windows machine and installs a range of developer tools
# Allow unattended reboots
$Boxstarter.RebootOk=$true
$Boxstarter.NoPassword=$false
$Boxstarter.AutoLogin=$true
$checkpointPrefix = 'BoxStarter:Checkpoint:'
@jbeda
jbeda / gist:0fb9748db43ecb14f72f8662516a8047
Last active March 8, 2019 20:33
I love `git commit --fixup`
# Have origin be your fork, upstream is upstream.
$ git remote -v
origin [email protected]:jbeda/kubernetes.git (fetch)
origin [email protected]:jbeda/kubernetes.git (push)
upstream [email protected]:kubernetes/kubernetes.git (fetch)
upstream [email protected]:kubernetes/kubernetes.git (push)
# Make some changes to a bunch of files in a multi commit PR
# Find the commit you want to tweak, copy the hash
@digitaljhelms
digitaljhelms / gist:3099010
Created July 12, 2012 15:58
Squash the first two commits in a git repository's history

The scenario

Your repository has two commits:

$ git log --oneline
957fbfb No, I am your father.
9bb71ff A long time ago in a galaxy far, far away....