Skip to content

Instantly share code, notes, and snippets.

View littledian's full-sized avatar
🤒
Out sick

littledian

🤒
Out sick
View GitHub Profile
@littledian
littledian / javdb-top250.md
Created July 12, 2025 00:09 — forked from jinjier/javdb-top250.md
JavDB top 250 movies list. [Updated on 2025/07]
@littledian
littledian / calculator
Created February 10, 2023 01:24
贷款计算器
const yearRate = 0.043; // 年利率
const monthRate = yearRate / 12; // 月利率
const totalMonth = 360; // 总共还款月数
// 等额本息,计算每月还款比例
let array = [];
for (let i = 0; i < totalMonth; i++) {
const total = array.reduce((prev, cur) => prev + cur, 0);
array.push(1 - total * monthRate);
}
@littledian
littledian / index.html
Created February 1, 2019 08:58
index.html
<html lang="zh">
<head title="倒计时"></head>
<style>
html, body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
display: flex;
align-items: center;
const values = [1, [2, 3, [4], 5], 6]
const keys = '[a, [b, c, [d], e], f]'
function parse (keys, values) {
const isArrayReg = /^\[(.+)]$/
const keyMatchReg = /(.*?)([\[|,\]])(.*)/
const arrayMatch = keys.match(isArrayReg)
if (!arrayMatch) return {}
let depth = 0
function canCalculate24 (...args) {
const length = args.length
if (length === 2) {
const [ a, b ] = args
let result = (a + b === 24) || (a * b === 24) || (Math.abs(a - b) === 24) || (a > b ? a / b === 24 : b / a === 24)
return result
} else {
for (let i = 0; i < length; i++) {
for (let j = i + 1; j < length; j++) {
const sub = []
const path = require('path')
const PrerenderSPAPlugin = require('prerender-spa-plugin')
const Renderer = PrerenderSPAPlugin.PuppeteerRenderer
module.exports = {
configureWebpack: config => {
if (process.env.NODE_ENV === 'production') {
// 为生产环境修改配置...
config.plugins.push(
new PrerenderSPAPlugin({
const Client = require('ssh2').Client
const fs = require('fs')
const path = require('path')
function downloadFile (source, target, option) {
return new Promise((resolve, reject) => {
const conn = new Client()
conn.on('ready', () => {
conn.sftp((err, sftp) => {
if (err) return reject(err)
createForeignObjectSVG = (
width: number,
height: number,
x: number,
y: number,
node: Node
) => {
const xmlns = 'http://www.w3.org/2000/svg';
const svg = document.createElementNS(xmlns, 'svg');
const foreignObject = document.createElementNS(xmlns, 'foreignObject');
export function drag (
{
mouseDownEvent,
element,
once = false,
mouseDownCallback = () => {},
mouseMoveCallback = () => {},
mouseUpCallback = () => {}
}) {
if (!mouseDownEvent && !element) {
module.exports = {
configureWebpack: config => {
if (process.env.NODE_ENV === 'development') {
config.devtool = 'eval-source-map'
}
config.output.devtoolModuleFilenameTemplate = info => {
let $filename = 'sources://' + info.resourcePath
if (info.resourcePath.match(/\.vue$/) && !info.identifier.match(/type=script/)) {
$filename = 'webpack-generated:///' + info.identifier + '?' + info.hash