This file contains hidden or 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 (global, factory) { | |
| typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | |
| typeof define === 'function' && define.amd ? define(factory) : | |
| (global.getJSONP = factory()); | |
| }(this, function () { 'use strict'; | |
| var global = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : this; | |
| return function getJSONP (url, callback) { | |
| var dt = new Date(); | |
| var callbackName = 'JSONP_' + Date.parse(dt) + dt.getMilliseconds(); |
This file contains hidden or 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
| const flatten = (f => | |
| (x => f(y => x(x)(y))) | |
| (x => f(y => x(x)(y))) | |
| )(fn => data => data.reduce((ary, item) => ary.concat(item.length ? fn(item) : item), [])) |
This file contains hidden or 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 clone (obj) { | |
| let ret | |
| switch (Object.prototype.toString.call(obj).slice(8, -1)) { | |
| case 'Array': | |
| return obj.map(val => clone(val)) | |
| case 'Set': | |
| case 'WeakSet': | |
| ret = [] | |
| obj.forEach(val => ret.push(clone(val))) | |
| return new Set(ret) |
This file contains hidden or 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
| const gulp = require('gulp') | |
| const rev = require('gulp-rev') | |
| const revCssUrl = require('gulp-rev-css-url') | |
| const cssSpriter = require('gulp-css-spriter') | |
| const clean = require('gulp-clean') | |
| gulp.task('sprite', ['clean'], () => gulp.src('./src/main.css') | |
| .pipe(cssSpriter({ | |
| spriteSheet: './temp/sprite.png', | |
| pathToSpriteSheetFromCSS: './sprite.png' |
This file contains hidden or 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
| export default (str, ...val) => console.log(str.reduce((a, b, i) => `${a}${b}${val[i] || ''}`, '')) |
This file contains hidden or 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
| [1,2,2,3,3,3,5,4,4,4,6].reduce((a, b, i, o) => (l = a.length, m = a[l - 1], l ? (m[m.length - 1] === b ? m.push(b) : (!~-m.length && (a[l - 1] = m[0]), a.push(i - o.length + 1 ? [b] : b)), a) : [[b]]), []) |
This file contains hidden or 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) |
This file contains hidden or 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 hidden or 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 hidden or 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 -> |