Skip to content

Instantly share code, notes, and snippets.

View yuchuanxi's full-sized avatar

小土豆 yuchuanxi

View GitHub Profile
@yuchuanxi
yuchuanxi / jsbin.genezosa.css
Created June 30, 2014 05:01
CSS实现li元素的value属性效果(>=IE8)
.list {
list-style: none;
padding: 0 0 0 13px;
counter-reset: item 2;
}
.list li {
position: relative;
padding: 0 0 0 20px;
counter-increment: item 1;
}
var gulp = require('gulp'),
sass = require('gulp-sass'),
browserify = require('gulp-browserify'),
concat = require('gulp-concat'),
embedlr = require('gulp-embedlr'),
refresh = require('gulp-livereload'),
lrserver = require('tiny-lr')(),
express = require('express'),
livereload = require('connect-livereload')
livereloadport = 35729,
@yuchuanxi
yuchuanxi / gulpfile.js
Last active August 29, 2015 14:09
基于node环境,实现网页自动同步,服务自动重启 -- gulp+nodemon+browserSync+express
/**
*
* @authors gooofly (QQ941721234, wangfei.f2e@gmail.com, http://www.gooofly.com)
* @date 2014-11-17 21:37:36
* @version $Id$
*
* title
* --------------------------------------------
*/
Element && !Element.prototype.matches && (function(proto) {
proto.matches = proto.matchesSelector ||
proto.mozMatchesSelector ||
proto.msMatchesSelector ||
proto.oMatchesSelector ||
proto.webkitMatchesSelector ||
function (selector) {
var node = this, nodes = (node.parentNode || node.document || element.ownerDocument)
.querySelectorAll(selector), i = -1;
@yuchuanxi
yuchuanxi / overloading.js
Last active March 24, 2016 10:04
Function overloading for Javascript
/**
*
* @authors yuChuanXi (http://yuchuanxi.com, wangfei.f2e@gmail.com)
* @date 2016-03-23 10:12:03
* @title title
* @description description
*/
'use strict';
// js 模拟重载函数 1
@yuchuanxi
yuchuanxi / partial.js
Created March 24, 2016 10:06
partial
/**
*
* @authors yuChuanXi (http://yuchuanxi.com, wangfei.f2e@gmail.com)
* @date 2016-03-24 17:43:55
* @title title
* @description description
*/
'use strict';
// 部分参数函数
@yuchuanxi
yuchuanxi / memoized.js
Last active March 25, 2016 07:45
memoized result for function
/**
*
* @authors yuChuanXi (http://yuchuanxi.com, wangfei.f2e@gmail.com)
* @date 2016-03-25 15:02:37
* @title title
* @description description
*/
'use strict';
/**
//http://www.cnblogs.com/52cik/p/js-hide-code.html
(function(window) {
var rep = { // 替换用的数据,使用了4个零宽字符,数据量减少了一半。
'00': '\u200b',
'01': '\u200c',
'10': '\u200d',
'11': '\uFEFF'
};
function hide(str) {
var areas = [{
"code": "110000",
"level": 1,
"parentCode": "110000",
"name": "北京市",
"lon": 39.929986,
"lat": 116.395645
}, {
"code": "110100",
"level": 2,