Skip to content

Instantly share code, notes, and snippets.

View jacob-lcs's full-sized avatar
❤️
coding with heart

Jacob jacob-lcs

❤️
coding with heart
View GitHub Profile
@jacob-lcs
jacob-lcs / localstorage.js
Last active January 2, 2021 10:24
对 localstorage 进行封装,使用方法见 comment
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 November 29, 2022 03:42
Node exec async (with shell.js and bluebird)
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 January 30, 2024 12:13
react + rollup + typescript boilerplate

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
@inorganik
inorganik / app.js
Last active March 31, 2024 21:13
Using CountUp.js in React
import { useEffect, useRef } from 'react'
// playground: https://stackblitz.com/edit/react-ts-nv5fxe?file=App.tsx
export default function App() {
// create a ref and declare an instance for each countUp animation
const countupRef = useRef(null);
let countUpAnim;