Skip to content

Instantly share code, notes, and snippets.

Avatar
❤️
coding with heart

Jacob jacob-lcs

❤️
coding with heart
View GitHub Profile
@jacob-lcs
jacob-lcs / localstorage.js
Last active Jan 2, 2021
对 localstorage 进行封装,使用方法见 comment
View localstorage.js
let storage = window.localStorage;
/**
* 判断是否为 JSON 对象
* @param obj
* @returns {boolean}
*/
function isJSON(obj) {
obj = JSON.stringify(obj);
return /^\{[\s\S]*\}$/.test(obj);
@davidrleonard
davidrleonard / execAsync.js
Last active Dec 1, 2021
Node exec async (with shell.js and bluebird)
View execAsync.js
const Promise = require('bluebird');
const sh = require('shelljs');
/**
* Asynchronously executes a shell command and returns a promise that resolves
* with the result.
*
* The `opts` object will be passed to shelljs's `exec()` and then to Node's native
* `child_process.exec()`. The most commonly used opts properties are:
*
@bcherny
bcherny / react-rollup-typescript.md
Last active Nov 18, 2021
react + rollup + typescript boilerplate
View react-rollup-typescript.md

terminal:

npm i --save-dev rollup rollup-watch rollup-plugin-typescript typescript typings
npm i -S react react-dom
./node_modules/.bin/typings install react react-dom --save
mkdir src dist
touch src/index.tsx