This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require("gulp") | |
var gulpif = require( 'gulp-if') | |
var jade = require("gulp-jade") | |
var stylus = require("gulp-stylus") | |
var autoprefixer = require("gulp-autoprefixer") | |
var minifyImg = require("gulp-imagemin") | |
var changed = require("gulp-changed") | |
var uglify = require("gulp-uglify") | |
var minifyCss = require("gulp-minify-css") | |
var browserSync = require('browser-sync') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ary=[1,[2,3],[4,[5,6],["7,8"],9],0,[1,2,[3,4,[5,"[6]",[7]],[8],[9]],0],[1,2,3]] | |
Math.max.apply({},JSON.stringify(ary).replace(/"[^"]*"|[0-9]|,/g,"").replace(/\[\]/g,"[x]").split("x").map(function(str,index,list){str += list.slice(0, index).join('');return str.split('[').length - str.split(']').length})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function add(n){ | |
var _callee=arguments.callee | |
if(typeof(n)=='number'){ | |
return function(m){ | |
if(typeof(m)=='number'){return _callee(n+m)} | |
else{return n} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Math.Gaussian = function (x, mu, sigma) { | |
return (1 / (Math.sqrt(2 * Math.PI) * sigma)) * Math.pow(Math.E, -Math.pow(x - mu, 2) / 2 * Math.pow(sigma, 2)); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs') | |
var createVueFile = function (path, option) { | |
console.log('Creating vue files...') | |
var files = fs.readdirSync(path) | |
files.forEach(function (componentName) { | |
var componentPath = path + '/' + componentName; | |
var stats = fs.statSync(componentPath) | |
stats.isDirectory() && ~function () { | |
var vueFile = componentPath + '/' + componentName + '.vue' | |
var htmlLang = option.html ? 'lang="' + option.html + '"' : '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* @file Check an object if all of its childrens are empty. | |
* @author Dafrok | |
* @param {object} obj | |
* @return {boolean} If all of the childrens of the target object are empty, it will be true, else, false. | |
*/ | |
;var empty = (function () { | |
var isEmpty | |
function type (obj) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Your init script | |
# | |
# Atom will evaluate this file each time a new window is opened. It is run | |
# after packages are loaded/activated and after the previous editor state | |
# has been restored. | |
# | |
# An example hack to log to the console when each text editor is saved. | |
# | |
# atom.workspace.observeTextEditors (editor) -> | |
# editor.onDidSave -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function shuffle(ary) { | |
let times = ary.length | |
while (times) { | |
ary.push(ary.splice(0 | Math.random() * times, 1)[0]) | |
times-- | |
} | |
return ary | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~function () { | |
var flag = true | |
var interval | |
function refresh() { | |
if (flag) { | |
console.log((new Date).toLocaleString()) | |
var iframe = document.createElement('iframe') | |
iframe.src = 'https://shop103422196.taobao.com/category.htm?spm=a1z10.3-c.w4002-6402908702.30.83cQDQ&_ksTS=1465271481288_143&callback=jsonp144&mid=w-6402908702-0&wid=6402908702&path=%2Fcategory.htm&orderType=newOn_desc' | |
document.body.appendChild(iframe) | |
iframe.onload = function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var table = document.createElement('table') | |
var thead = document.createElement('thead') | |
var tbody = document.createElement('tbody') | |
var firstTr = document.createElement('tr') | |
var firstTh = document.createElement('th') | |
table.appendChild(thead) | |
table.appendChild(tbody) | |
thead.appendChild(firstTr) | |
firstTr.appendChild(firstTh) |
OlderNewer