Skip to content

Instantly share code, notes, and snippets.

🍑
Happy coding

heineiuo heineiuo

🍑
Happy coding
Block or report user

Report or block heineiuo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@heineiuo
heineiuo / lint.js
Created Aug 29, 2018
use standardjs with pre-commit hook
View lint.js
const { exec } = require('shelljs')
const path = require('path')
const exit = () => {
console.log('JavaScript Standard Style errors were detected. Aborting commit.')
process.exit(1)
}
const gitdiff = exec(`git diff --name-only --cached --relative`)
if (gitdiff.stderr) {
@heineiuo
heineiuo / font-adjust.js
Last active Aug 18, 2017
百度脑图对文字居中兼容处理
View font-adjust.js
/**
* source: https://github.com/fex-team/kityminder-core/blob/dev/src/module/text.js#L10-L127
*/
/**
* 针对不同系统、不同浏览器、不同字体做居中兼容性处理
* 暂时未增加Linux的处理
*/
var FONT_ADJUST = {
'safari': {
@heineiuo
heineiuo / all_node_js_internal_modules.json
Last active Aug 15, 2017
All node.js internal modules
View all_node_js_internal_modules.json
{
"v8.x": {
"all": [
"assert",
"async_hooks",
"buffer",
"child_process",
"cluster",
"crypto",
"dns",
@heineiuo
heineiuo / README.md
Last active Jul 4, 2017
get native `db` from mongoose
View README.md
  1. 可以从Model里获取
const Users = mongoose.model('User', new mongoose.Schema({}), 'users')
const db = Users.db

// 然后就可以使用db了,比如 db.collection('users').find({}).toArray()
You can’t perform that action at this time.