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 { readFile } = require('fs') | |
const { join: joinPath } = require('path') | |
const { createServer } = require('http') | |
const { render: renderLess } = require('less') | |
const { startService } = require('esbuild') | |
const express = require('express') | |
const staticPath = joinPath(__dirname, 'static') | |
const resolveFilePath = (path) => joinPath(staticPath, path) |
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 java.util.concurrent.ThreadLocalRandom; | |
import java.util.stream.IntStream; | |
public class InsertionSortAndSelectionSort { | |
public static void main(String[] args) { | |
runBenchmarkN(1000); | |
runBenchmarkN(10000); | |
runBenchmarkN(100000); | |
} |
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 xlsx from 'xlsx' | |
export function importExcelFile(file) { | |
return new Promise((resolve, reject) => { | |
function handleOnLoad(event) { | |
try { | |
const { result } = event.target; | |
const workbook = xlsx.read(result, { type: 'binary' }); | |
const sheetsData = []; | |
for (const sheet of Object.entries(workbook.Sheets)) { |
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 handler = (Consumer<byte[]>) (bytes) -> { | |
CompletableFuture.runAsync(() -> { | |
var readStr = new String(bytes); | |
System.out.println("readStr: " + readStr); | |
}); | |
}; | |
var inputStream = System.in; | |
var readThread = new Thread(() -> { | |
try { |
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 classNameSet = new Set() | |
function getRandomClassName() { | |
const className = Math.random().toString(36).substring(2) | |
if (classNameSet.has(className)) { | |
return getRandomClassName() | |
} | |
classNameSet.add(className) | |
return `css-${className}` | |
} |
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
async function getRepositoryCloneListByPage(name, page = 1) { | |
const response = await fetch(`https://api.github.com/users/${name}/repos?page=${page}`) | |
const result = await response.json() | |
return result.map((it) => { | |
return it.clone_url | |
}) | |
} | |
async function getRepositoryCloneList(name) { | |
let page = 1 |
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
<template> | |
<input type="text" | |
inputmode="numeric" | |
:value="editing ? value : formattedValue" | |
@focus="editing = true" | |
@blur="editing = false" | |
@input="value = $event.target.value" | |
placeholder="Enter" | |
pattern="[0-9]*"/> | |
</template> |
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 React, { useReducer } from 'react' | |
import styled from '@emotion/styled' | |
import { sleep } from '../../utils/schedule.js' | |
const initialState = { count: 7n } | |
function reducer(state = initialState, action) { | |
if (action.type === 'setCount') { | |
return { | |
...state, |
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 React, { Component, useRef } from 'react' | |
import styled from '@emotion/styled' | |
import { sleep } from '../../utils/schedule.js' | |
const Container = styled.div` | |
box-sizing: border-box; | |
position: relative; | |
display: flex; | |
flex-direction: column; | |
justify-content: center; |
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 React, { useState } from 'react' | |
import styled from '@emotion/styled' | |
import murmur3 from '../../utils/murmurhash3_32.js' | |
const Container = styled.div` | |
display: flex; | |
justify-content: center; | |
align-items: center; | |
flex-direction: column; | |
height: 75vh; |
OlderNewer