Skip to content

Instantly share code, notes, and snippets.

@sindresorhus
sindresorhus / esm-package.md
Last active May 5, 2024 20:24
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.
@doitian
doitian / registries.conf
Last active April 28, 2024 14:00
[Configure Docker Hub mirror in /etc/containers/registries.conf] #docker #podman #proxy
unqualified-search-registries = ['docker.io']
[[registry]]
prefix = "docker.io"
location = "docker.io"
[[registry.mirror]]
prefix = "docker.io"
# This will set the docker registry mirror of a chinese university.
# DON'T use it unless you have a network connection issue and you trust the mirror provider.
@kgriffs
kgriffs / string_util.lua
Created May 27, 2020 17:41
Lua string utilities (contains, startswith, endswith, replace, insert)
function string:contains(sub)
return self:find(sub, 1, true) ~= nil
end
function string:startswith(start)
return self:sub(1, #start) == start
end
function string:endswith(ending)
@serinth
serinth / makefile
Created March 8, 2018 19:21
Golang Makefile
# Basic Makefile for Golang project
# Includes GRPC Gateway, Protocol Buffers
SERVICE ?= $(shell basename `go list`)
VERSION ?= $(shell git describe --tags --always --dirty --match=v* 2> /dev/null || cat $(PWD)/.version 2> /dev/null || echo v0)
PACKAGE ?= $(shell go list)
PACKAGES ?= $(shell go list ./...)
FILES ?= $(shell find . -type f -name '*.go' -not -path "./vendor/*")
# Binaries
PROTOC ?= protoc
@ipedrazas
ipedrazas / dump
Created April 22, 2017 04:10
Mongo dump/restore with docker
# Backup DB
docker run \
--rm \
--link running_mongo:mongo \
-v /data/mongo/backup:/backup \
mongo \
bash -c ‘mongodump --out /backup --host $MONGO_PORT_27017_TCP_ADDR’
# Download the dump
scp -r USER@REMOTE:/data/mongo/backup ./backup
@tomysmile
tomysmile / mac-setup-redis.md
Last active March 18, 2024 22:12
Brew install Redis on Mac

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis
@Pencroff
Pencroff / CamelCaseMacro.velocity
Last active January 30, 2024 12:56
Transformation file name to CamelCase in IntelliJ IDEA file templates
## file name transformation
## file-name => FileName
## Sources:
## http://stackoverflow.com/questions/6998412/velocity-string-function
## http://stackoverflow.com/questions/21288687/using-velocity-split-to-split-a-string-into-an-array-doesnt-seem-to-work
## http://velocity.apache.org/engine/releases/velocity-1.7/apidocs/org/apache/velocity/util/StringUtils.html#split(java.lang.String, java.lang.String)
#set( $CamelCaseName = "" )
#set( $part = "" )
@overtrue
overtrue / Kernel.php
Last active September 4, 2016 04:55
PHP Tips
<?php
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel {
/**
* The application's global HTTP middleware stack.
@huqi
huqi / trial.key
Created April 11, 2015 09:01
Beyond Compare 4 license for Mac
Beyond Compare 4
Licensed to: ASIO Allsoftinone
Quantity: 1 user
Serial number: 1822-9597
License type: Pro Edition for Windows
--- BEGIN LICENSE KEY ---
H1bJTd2SauPv5Garuaq0Ig43uqq5NJOEw94wxdZTpU-pFB9GmyPk677gJ
vC1Ro6sbAvKR4pVwtxdCfuoZDb6hJ5bVQKqlfihJfSYZt-xVrVU27+0Ja
hFbqTmYskatMTgPyjvv99CF2Te8ec+Ys2SPxyZAF0YwOCNOWmsyqN5y9t
@barryvdh
barryvdh / .phpstorm.meta.php
Last active October 20, 2021 22:16
Laravel PhpStorm Meta file
<?php
namespace PHPSTORM_META {
/**
* PhpStorm Meta file, to provide autocomplete information for PhpStorm
* Generated on 2017-09-28.
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
* @see https://github.com/barryvdh/laravel-ide-helper
*/