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 byteSize from 'byte-size'; | |
const manifest = []; | |
process.on('beforeExit', () => { | |
console.table(manifest); | |
}); | |
export default () => ({ | |
name: 'Size', |
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
{ | |
name: 'InlineScriptHTMLRender', | |
async generateBundle(_, bundles, isWrite) { | |
if (isWrite) { | |
return new Promise((resolve) => { | |
Object.values(bundles).map((bundle) => { | |
Object.keys(bundles).map(key => delete bundles[key]); | |
if (bundle.name === 'bootloader') { | |
renderFile('src/index.ejs', { | |
inlineScript: bundle.code, |
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 replace from '@rollup/plugin-replace'; | |
let manifest = {}; | |
export const replaceManifest = () => { | |
return replace({ | |
__MANIFEST__: () => JSON.stringify(manifest), | |
}); | |
}; |
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 const doThis = count => Array.prototype.map.bind(Array.from({ length: count })); | |
export const Timeout = (timeout, promise?: Promise<any>) => | |
new Promise((resolve, reject) => { | |
const timer = setTimeout(() => { | |
reject(new Error(`Timeout(${timeout})`)); | |
}, timeout); | |
// 如果完成了得清理 | |
const clear = () => clearTimeout(timer); | |
promise.then(clear, clear); |
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
interface Test<T> { | |
g?: Test<T>; | |
} | |
function mixinPerson<T extends Constructor<{}>>(Base: T) { | |
return class Base { | |
constructor(public name: string) { } | |
} |
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
#!/bin/ts-node | |
const SymbolCache = Symbol.for("cache"); | |
let miss = 0; | |
function computed(...args) { | |
const _cache = {}; | |
return function ( | |
target, | |
propertyKey: string, |
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 node | |
// DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
// Version 2, December 2004 | |
// Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> | |
// Everyone is permitted to copy and distribute verbatim or modified | |
// copies of this license document, and changing it is allowed as long | |
// as the name is changed. |
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
#![allow(dead_code)] | |
use std::collections::HashMap; | |
use std::collections::HashSet; | |
trait Renderable { | |
fn render(&mut self) { | |
unimplemented!() | |
} | |
} |
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() { | |
'use strict'; | |
jQuery(document).ready(function() { | |
let Language = { | |
"C": "c_cpp", | |
"C++": "c_cpp", | |
"Java": "java", | |
"JavaScript": "javascript", | |
"Python": "python" | |
}; |
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 TINGYUN = function (t, e, n) { | |
function r(t) { | |
var e = !!t && "length" in t && t.length, n = typeof t; | |
return "function" !== n && ("array" === n || 0 === e || "number" == typeof e && e > 0 && e - 1 in t) | |
} | |
function i(t, e) { | |
var n, i = 0; | |
if (t) if (r(t)) for (n = t.length; i < n && !1 !== e.call(t[i], t[i], i); i++) ; else for (i in t) if (!1 === e.call(t[i], t[i], i)) break; | |
return t |