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
export default function doWaterfallLayout({ | |
container, | |
columnWidth, | |
selector = ':scope > *', | |
}: { | |
container: HTMLElement; | |
selector?: string; | |
columnWidth: number; | |
}): void { | |
const columnCount = Math.max( |
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
#!/usr/bin/env ts-node-script | |
import { program } from 'commander'; | |
import * as _fs from 'fs'; | |
import { promisify } from 'util'; | |
import * as ts from 'typescript'; | |
import { ESLint } from 'eslint'; | |
const readFile = promisify(_fs.readFile); | |
const writeFile = promisify(_fs.writeFile); |
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
import msvcrt | |
import threading | |
import time | |
from typing import Callable, Set, Text | |
import win32con | |
import win32gui | |
def message_box( |
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
import { wrapCallSite } from 'source-map-support'; | |
export default function captureStackTrace(skip = 0): NodeJS.CallSite[] { | |
const rawPrepareStackTrace = Error.prepareStackTrace; | |
try { | |
Error.prepareStackTrace = (_, stack) => stack; | |
const v: { stack: NodeJS.CallSite[] } = { stack: [] }; | |
Error.captureStackTrace(v); | |
return v.stack.slice(1 + skip).map(i => wrapCallSite(i)); | |
} finally { |
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
/** Split string to exact n parts, last part may contains splitter. */ | |
export default function splitN(v: string, splitter: string, n: number): string[] { | |
const parts = v.split(splitter); | |
const ret = parts.slice(0, n); | |
while (ret.length < n) { | |
ret.push(''); | |
} | |
ret[n - 1] = parts.slice(n - 1).join(splitter); | |
return ret; | |
} |
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
/** clone Date object with a optional offset and data override */ | |
export default function cloneDate( | |
date: Date, | |
offset?: { | |
year?: number; | |
month?: number; | |
day?: number; | |
hour?: number; | |
minute?: number; | |
seconds?: number; |
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
export function getCommonPrefix(v: string[]): string { | |
if (v.length === 0) { | |
return ''; | |
} | |
if (v.length === 1) { | |
return v[0]; | |
} | |
// return range is [0, w) | |
let w = v[0].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
new HtmlPlugin({ | |
/** @param {{compilation: import('webpack').compilation.Compilation}} */ | |
templateContent: ({ compilation }) => { | |
const { | |
hash, | |
publicPath, | |
assetsByChunkName, | |
assets, | |
} = compilation.getStats().toJson({ all: true }, true); | |
return JSON.stringify( |
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
import type { StyleValue } from 'vue'; | |
import { computed, reactive, ref } from 'vue'; | |
export default function useVirtualScroll({ | |
x, | |
y, | |
}: { | |
x?: { | |
totalCount: () => number; | |
itemWidth: () => number; |
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
import { Component, Prop, Vue } from 'vue-property-decorator'; | |
/** | |
* Mixin for support `dialog.show` | |
*/ | |
@Component | |
export class ModalMixin extends Vue { | |
@Prop({ default: false, type: Boolean }) | |
public visible!: boolean; |
NewerOlder