Skip to content

Instantly share code, notes, and snippets.

View bishil06's full-sized avatar
🏠
Working from home

bishil06 bishil06

🏠
Working from home
View GitHub Profile
console.log('test')
@bishil06
bishil06 / index.html
Created August 6, 2022 08:47
web file access api + web stream = unzip application
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1 id="selectFile"></h1>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
</head>
<body>
<h1>Hello World!</h1>
<p>Drag the boxes below to somewhere in your OS (Finder/Explorer, Desktop, etc.) to copy an example markdown file.</p>
@bishil06
bishil06 / promiseMarathon.js
Last active March 1, 2021 09:36
JavaScript Async Generator that yields in the order of the earliest completion of the promises
const util = require("util")
function delay(time, data) {
return new Promise((res, rej) => {
setTimeout(() => res(data), time);
})
}
async function *promiseMarathon(...promises) {
while (promises.length > 0) {
@bishil06
bishil06 / permutation.js
Created February 25, 2021 05:50
JavaScript Array Permutation es2015 generator
function *permutation(arr, size = arr.length) {
yield *permutUntil(arr);
function *permutUntil(list, picked=[]) {
if (list.length === arr.length - size) {
// μ›ν•˜λŠ” 길이만큼 λ½‘νžλ•ŒκΉŒμ§€ 반볡
return yield picked;
}
for(let i=0; i<list.length; i++) {
let copiedList = list.slice(); // deep copy
@bishil06
bishil06 / factorials.js
Created February 25, 2021 04:07
JavaScript factorial algorithm
function forFacto(n) {
for(var i=1; n>0; i *= n--);
return i;
}
function recurFacto(n) {
if (n === 1) {
return 1;
}
return n * recurFacto(n-1);
@bishil06
bishil06 / timeComplexity.c
Created February 23, 2021 22:24
C show time complexity
#include <stdio.h>
#include <time.h>
#include <math.h>
int timeOne(n) {
return n;
}
void timeN(n) {
while(n) {
@bishil06
bishil06 / _NodeJS_Reverse_Array.md
Created February 18, 2021 21:39
_JavaScript_Reverse_Array

JS Reverse Array

let arr1 = Array.from({length: 10000000}, (_, i) => i);

Node version 15.8

  • reverse method 274ms
@bishil06
bishil06 / queue.js
Created February 9, 2021 04:31
_JavaScript_queue
class Queue {
constructor() {
this.list = [];
this.first = null;
}
enqueue(v) {
if (this.first === null) {
this.first = v;
}
@bishil06
bishil06 / stack.js
Created February 9, 2021 04:22
_JavaScript_stack
class Stack{
constructor() {
this.list = [];
this.top = null;
}
push(v) {
this.list.push(v);
this.top = v;
}