Skip to content

Instantly share code, notes, and snippets.

View Debiancc's full-sized avatar
:octocat:
Focusing

Debiancc Debiancc

:octocat:
Focusing
View GitHub Profile
@sindresorhus
sindresorhus / esm-package.md
Last active April 26, 2024 03:53
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.
@VincentSit
VincentSit / update_gfwlist.sh
Last active March 24, 2024 14:39
Automatically update the PAC for ShadowsocksX. Only tested on OS X. (Deprecated)
#!/bin/bash
# update_gfwlist.sh
# Author : VincentSit
# Copyright (c) http://xuexuefeng.com
#
# Example usage
#
# ./whatever-you-name-this.sh
#
# Task Scheduling (Optional)
@telekosmos
telekosmos / uniq.js
Last active November 15, 2022 17:13
Remove duplicates from js array (ES5/ES6)
var uniqueArray = function(arrArg) {
return arrArg.filter(function(elem, pos,arr) {
return arr.indexOf(elem) == pos;
});
};
var uniqEs6 = (arrArg) => {
return arrArg.filter((elem, pos, arr) => {
return arr.indexOf(elem) == pos;
});
@leeluolee
leeluolee / keyOf
Created June 9, 2015 12:44
keyOf讨论
var keyOf = function(oneKeyObj) {
var key;
for (key in oneKeyObj) {
if (!oneKeyObj.hasOwnProperty(key)) {
continue;
}
return key;
}
return null;
};
@edokeh
edokeh / index.js
Last active April 18, 2024 08:07
佛祖保佑,永无 BUG
//
// _oo0oo_
// o8888888o
// 88" . "88
// (| -_- |)
// 0\ = /0
// ___/`---'\___
// .' \\| |// '.
// / \\||| : |||// \
// / _||||| -:- |||||- \
@heroicyang
heroicyang / handlebars.debugHelper.js
Created June 19, 2013 04:00
Handlebars调试技巧:增加如下helper之后,在模板文件里使用{{debug}}或是{{debug someValue}}即可
Handlebars.registerHelper("debug", function(optionalValue) {
console.log("Current Context");
console.log("====================");
console.log(this);
if (optionalValue) {
console.log("Value");
console.log("====================");
console.log(optionalValue);
}
});
@mbostock
mbostock / .block
Last active September 20, 2018 16:23 — forked from mbostock/.block
Clustered Force Layout II
license: gpl-3.0