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 getDaysInWeek(year, month) { | |
function getDaysInMonth(year, month) { | |
return new Date(year, month, 0).getDate(); | |
} | |
const monthDays = getDaysInMonth(year, month); | |
console.log(monthDays); | |
let startDate = 1; | |
const results = []; | |
while (startDate <= monthDays) { | |
const week = [0, 0, 0, 0, 0, 0, 0]; |
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 getScrollTop() { | |
var scroll_top = 0 | |
if (document.documentElement && document.documentElement.scrollTop) { | |
scroll_top = document.documentElement.scrollTop | |
} else if (document.body) { | |
scroll_top = document.body.scrollTop | |
} | |
return scroll_top | |
} |
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
const rotate = function (matrix, direction) { | |
for (let y = 0; y < matrix.length; ++y) { | |
for (let x = 0; x < y; ++x) { | |
[matrix[x][y], matrix[y][x]] = [matrix[y][x], matrix[x][y]]; | |
} | |
} | |
if (direction === 'clockWise') { | |
// 顺时针旋转 | |
matrix.forEach((row) => row.reverse()); | |
} else { |
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
const path = require("path"); | |
const { execSync } = require("child_process"); | |
const fs = require("fs"); | |
const makeNewMkv = (dirPath, mkvPath, assPath) => { | |
const mkvName = path.basename(mkvPath).match(/S[\d]{2}E[\d]{2}/)[0]; | |
console.log("mkvName", mkvName); | |
if (fs.existsSync(path.resolve(dirPath, mkvName + ".mkv"))) { | |
console.log(`${mkvName}已存在`); | |
return; |
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 ip(str) { | |
var length = str.length; | |
var ans = 0; | |
var stack = []; | |
var step = 0; | |
var lastStep = 0; | |
var lastchar = '' | |
// 处理每一次位移 | |
function handle() { |
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 ip(str) { | |
var length = str.length; | |
var ans = []; | |
var stack = []; | |
var step = 0; | |
var lastStep = 0; | |
var lastchar = '' | |
// 生成原始数组 | |
for (var i = 0; i < 32; i++) { |
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
/* Drag'n drop stuff */ | |
var drag = document.getElementById("drag"); | |
drag.ondragover = function(e) {e.preventDefault()} | |
drag.ondrop = function(e) { | |
e.preventDefault(); | |
var length = e.dataTransfer.items.length; | |
for (var i = 0; i < length; i++) { | |
var entry = e.dataTransfer.items[i].webkitGetAsEntry(); | |
var file = e.dataTransfer.files[i]; |
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
graphql,Postgres,graphql-relay-js,前端: relay |
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 through = require('through2'); | |
module.exports = function() { | |
return through.obj(function (file, enc, cb) { | |
if (file.isNull()) { | |
cb(null, file); | |
return; | |
} | |
if (file.isStream()) { | |
cb(new gutil.PluginError('gulp-mp-upai-upload', 'Streaming not supported')); |
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 yamlish = require('yamlish'); // npm install yamlish | |
// md文件头部类似下面的注释信息,为了不会于文章里的注释符号冲突,加了>> | |
// 第一行需要时空行,因为yamlish库是从第二行开始解析得,你妹啊 | |
/*<< |