This file contains hidden or 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 genRandStr = n => | |
| Array.apply(null, Array(n + 1)) | |
| .map((a, i) => i) | |
| .reduce(a => a += "abcdefghijklmnopqrstuvwxyz1234567890".charAt(Math.random() * 36)) | |
| .substr(1); | |
| genRandStr(20); |
This file contains hidden or 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
| <!doctype html><html contenteditable><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Template</title> | |
| <style>*{font-size: 1rem;font-family:Verdana;line-height:1.5;}body{margin:.5rem;}</style> | |
| <body><script>//mongoexport --collection=events --db=reporting --out=events.json | |
| window.onload = function() { | |
| fetch('data.json').then(r => r.json()).then(rows => { | |
| const arr = []; | |
| rows.filter(r => true).map(row => { | |
| arr.push(row.str); | |
| }); | |
| document.body.innerHTML = `["${arr.join('","')}"]`; |
This file contains hidden or 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
| onload = _ => { | |
| //setUrlParam will trigger `render` | |
| onLocationChange(render); | |
| }; | |
| const getUrlParam = param => { | |
| const urlArr = document.location.href.split`?`; | |
| const paramArr = urlArr.length > 1 ? urlArr[1].split`&` : []; | |
| const dataPair = paramArr.find(a => a.indexOf(param + "=") === 0); | |
| return dataPair ? dataPair.split`=`[1].replace(/%20/g, " ") : false; |
This file contains hidden or 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
| <!doctype html> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"/> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"/> | |
| <title>{title}</title> | |
| <meta name="author" content="Lewis Nakao"> | |
| <meta name="description" content="{description}"> | |
| <meta name="keywords" content="JavaScript, Emoji, HTML Canvas, Open Source"> |
This file contains hidden or 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
| <table id=t></table><script>addEventListener("keydown",e=>t.innerHTML=["key","keyCode","code"].map(a=>`<tr><td>${a}</td><td>${e[a]}</td></tr>`).join(""))</script> |
This file contains hidden or 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
| <style id=style></style> | |
| <script id=script></script> | |
| <div class="accordion" id="accordionExample"> | |
| <div class="accordion-item"> | |
| <h2 class="accordion-header" id="headingOne"> | |
| <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne"> | |
| Accordion Item #1 | |
| </button> | |
| </h2> |
This file contains hidden or 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
| <div id=o></div><script> | |
| d=document; | |
| c="⬛⬜🟥🟦🟨🟩🟧🟪🟫".split(/.*?/u); //square emojis | |
| b=c[0]; //background color | |
| s=c[5]; //selected color | |
| g=[]; //the grid | |
| //create new array and fill it | |
| a=(n,m)=>new Array(n).fill(m); |
This file contains hidden or 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 Year Gift - Curated List of Top 75 LeetCode Questions to Save Your Time | |
| https://www.teamblind.com/post/New-Year-Gift---Curated-List-of-Top-75-LeetCode-Questions-to-Save-Your-Time-OaM1orEU | |
| */ | |
| const top75problems = [ | |
| { name: "Two Sum", category: "Array", problem: "two-sum" }, | |
| { name: "Best Time to Buy and Sell Stock", category: "Array", problem: "best-time-to-buy-and-sell-stock" }, | |
| { name: "Contains Duplicate", category: "Array", problem: "contains-duplicate" }, | |
| { name: "Product of Array Except Self", category: "Array", problem: "product-of-array-except-self" }, | |
| { name: "Maximum Subarray", category: "Array", problem: "maximum-subarray" }, |
This file contains hidden or 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
| <pre id=o></pre> | |
| <script> | |
| const UNITS = ",K,M,G,T,P".split(","); | |
| const UNIT_SIZES = UNITS.reduce((prev, curr, i) => { | |
| prev[curr] = Math.pow(1024, i); | |
| return prev; | |
| }, {}); | |
| const formatBytes = bytes => { | |
| let size, unit; |
This file contains hidden or 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
| <pre id=o></pre> | |
| <script> | |
| class LinkedList { | |
| constructor(value, next) { | |
| this.value = value; | |
| this.next = next; | |
| } | |
| } |