Skip to content

Instantly share code, notes, and snippets.

View olanipekunife's full-sized avatar
🎨

Ifeoluwa Olanipekun olanipekunife

🎨
View GitHub Profile
@sindresorhus
sindresorhus / esm-package.md
Last active November 1, 2024 20:38
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.
@olanipekunife
olanipekunife / convertSheet.js
Created October 5, 2020 06:54
convert csv string to array
const detectNewline = string => {
if (typeof string !== 'string') {
throw new TypeError('Expected a string');
}
const newlines = string.match(/(?:\r?\n)/g) || [];
if (newlines.length === 0) {
return;
}
@olanipekunife
olanipekunife / countries+states
Created August 24, 2020 09:03
list of countries with states
[
{
"code2": "AF",
"code3": "AFG",
"name": "Afghanistan",
"capital": "Kabul",
"region": "Asia",
"subregion": "Southern Asia",
"states": [
{
@ebectar
ebectar / deploy-react-surge.md
Last active September 24, 2024 19:10
How to deploy a create-react-app to Surge

Deploying a React app with Surge (from Create React App format)

1. Make sure you have surge installed globally

  • npm install -g surge

2. Run the Create React App build

  • cd your-react-project
  • npm run build
@subfuzion
subfuzion / curl.md
Last active November 2, 2024 04:27
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE