Skip to content

Instantly share code, notes, and snippets.

View NinoFocus's full-sized avatar

Nino NinoFocus

  • Youzan
  • Hangzhou, China
View GitHub Profile
@NinoFocus
NinoFocus / dockerrun.sh
Last active November 7, 2019 14:43
将前端本地构建任务代理到docker上执行
#/bin/sh
# 依赖的node版本
requiredNodeVersion="8.12.0"
# docker image
requiredImage="node:${requiredNodeVersion}"
# 本机已经安装的node images版本
installedNodeImageVersions=`docker images node --format "{{json .Tag}}"`
@NinoFocus
NinoFocus / isIdCard.js
Last active September 6, 2017 10:50
检测输入的字符串是否是新版身份证号码
const WEIGHT_MAP = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]
const INSPECT_MAP = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2']
/**
* [isIdCard description]
* @param {String} idCard 身份证字符串
* @return {Boolean}
*/
export default function isIdCard(idCard) {
if (!idCard || typeof idCard !== 'string' || idCard.length < 18) return false
@NinoFocus
NinoFocus / to_css_unicode.js
Last active August 29, 2015 14:12
to_css_unicode
// 文字转为CSS友好的Unicode
// 在JavaScript的控制台中执行
//
// to_css_unicode('启用') ==> '\542F\7528'
function to_css_unicode(text) {
return escape(text).replace(/\%u/g, '\\');
}
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" vundle
Plugin '[email protected]:gmarik/Vundle.vim.git'
" powerline
Plugin '[email protected]:Lokaltog/vim-powerline.git'
/**
* 判断对象的类型
* @param {Object} obj
* @return {String}
*/
function $typeof(obj) {
return Object.prototype.toString.call(obj).replace(/^\[object |\]$/g,'').toLowerCase();
}
@NinoFocus
NinoFocus / javascript-usage-and-skill.js
Created February 16, 2012 05:59
JavaScript 惯用法和技巧
// 检测空串
if (!$.trim(str)) {
}
// 字符串/数字类型转换
var str = '100';
var num = str - 0;