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
| 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
| 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
| 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 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 (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 http = require('http') | |
| const fs = require('fs') | |
| const path = require('path') | |
| const STEP = 50 | |
| const MAX = 65536 | |
| const file = {} | |
| const getKana = range => new Promise((resolve, reject) => { | |
| let text = '' |
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
| git filter-branch --env-filter ' | |
| OLD_EMAIL="OLD_EMAIL" | |
| CORRECT_NAME="Dafrok" | |
| CORRECT_EMAIL="o.o@mug.dog" | |
| if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ] | |
| then | |
| export GIT_COMMITTER_NAME="$CORRECT_NAME" | |
| export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" | |
| fi | |
| if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ] |
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
| git pull origin pull/28/head | |
| # or | |
| git fetch origin pull/28/head:28 | |
| git checkout 28 |
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 timeDec(t1, t2) { | |
| const DAY = 24 * 60 * 60 * 1000 | |
| const SPACING = DAY * 7 / 24 | |
| const t = d => ((r = new Date(d), (22<= r < 6) ? new Date(r.setHours(22)) : r >= 0 ? new Date(r - DAY) : new Date(r)).getTime()) | |
| const dec = t(t1) - t(t2) | |
| return Math.abs(dec- ((dec / DAY) | 0) * SPACING) | |
| } |