You are an expert at JavaScript and C#
. You must format indents using 2 spaces, and you must wrap strings using doublequotes " instead of '.
Let's think step by step.
// console.save.js -- download your JavaScript objects from your web browser's F12 Dev Tools console! (also Bookmarklet click defaults to saving current selection or body.innerText as `DL-[date].md`) | |
// javascript:void function(){let a=Object,b=document,c=(c,d,e)=>{let f=URL,g=f.createObjectURL(c=new Blob([c],{type:e||c?.type||"application/octet-stream"}));a.assign(b.createElement("a"),{href:g},!0===d?{target:"_blank"}:{download:d||""}).click(),f.revokeObjectURL(g)},d=a=>a,e=()=>{if(b.onselectstart&&b.onselectstart!==d)return b.onselectstart=d,alert("Text selecting was disabled!\n\nTry again, it is now enabled...");let a=b.getSelection(),c=a&&"Range"===a.type&&a.getRangeAt(0),e=c&&b.createElement("div"),f=e?(e.appendChild(c.cloneContents()),e.innerText):"";return f},f=a.assign(console,{save:(a,d,f)=>{a==null&&(a=e(),""===a.trim()&&(a=b.body.innerText));let g="object"==typeof a;g&&(a=JSON.stringify(a,0,4));c(a,d||`DL-${+new Date}.${g?".json.txt":"md"}`,f||(g?"application/json":"octet-stream"))}});f.save()}(); |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>ChatGPT Playground (starting up)</title> | |
<style> | |
.byline { | |
font-family: Verdana; | |
font-size: 80%; |
// MarkDownLivePreview.com-resizer.js -- bookmarklet to add [Toggle Editor] (and also horizontal resizer) - instead of waiting for repo update using <script defer src="resizer.js"></script> | |
// 1710 char javascript:void function(){if(!document.getElementById("resizer")){let a=location,b="markdownlivepreview.com";if(a.hostname!=b)a.href="https://"+b;else{let a=document,b=b=>a.getElementById(b),c=b("container"),d=b("edit"),e=b("preview"),f=!1,g=b("copy-button");a.head.insertAdjacentElement("afterBegin",Object.assign(a.createElement("style"),{id:"resizer.css",innerHTML:"\n body {\n margin: 0;\n height: 100vh;\n overflow: hidden;\n }\n #container {\n display: flex;\n width: 100%;\n height: 100%;\n overflow: hidden;\n }\n #edit, #preview {\n flex-grow: 1;\n overflow: auto;\n transition: flex 0.3s ease;\n }\n #resizer {\n width: 4px;\n background-color: green;\n cursor: col-resize;\n flex-shrink: 0;\n }\n #toggle-button {\n margin-left: 16px;\n }\n .shrunk {\n |
// ytSubs.js (SEE DISCLAIMER) - via @DarrenSem https://gist.github.com/DarrenSem (22Mar2024) | |
// YouTube subtitles - English (auto-generated) CC (closed captions) | |
// Usage: node ytSubs.js videoIdOrUrl | |
// or Web browser BOOKMARKLET (contents open in a new window) | |
// ES6 clickable Bookmarklet = 3923 chars: | |
//javascript:void function(){"use strict";var e=String.fromCharCode;const n=!1,d=globalThis,{process:i}=d,t=console,u=async(e,n,d="text")=>fetch(e,n).then(e=>e[d]()),a=e=>{try{e=(e||"")+"";const n=e.match(/"captionTracks":.*"isTranslatable"\:.*?}]/),d=JSON.parse(`{${(n||[""])[0]}}`).captionTracks||[],i=d.map(e=>{const n=e.name;return[l(n.simpleText||n.runs&&n.runs[0].text),e.baseUrl+"&fmt=json3"]});return i}catch(n){}},r=e=>{e=new Date(e);let n=e.getDate();return isNaN(n)?null:`${(n+"").padStart(2,"0")}${e.toLocaleString("default",{month:"short"})}${e.getFullYear()}`},f=e=>{e="string"!=typeof e&&e?new URL(e):{href:e||""};const n=e&&e.href.trim()||"",d=n.replace(/(https?:\/\/)?\/*(.+?)\/?$/,"https://$2"),i=d |
"use strict"; | |
const { URL } = require("."); | |
const inputs = [ | |
"https://\u0000y", | |
"https://x/\u0000y", | |
"https://x/?\u0000y", | |
"https://x/?#\u0000y" | |
]; |
// store.js ALL-IN-ONE function: () = dump Storage, (keyOrNS, value OTHER THAN undefined) = return value after setting it, (keyOrNS) = return value - UNDEFINED if missing, (null, keyOrNS) = removeItem(keyOrNS) then return keyOrNS | |
// let store=(k,d,s=localStorage,z=s.getItem(k))=>null==k?null==d?s:(s.removeItem(d),d):void 0===d?null==z?void 0:JSON.parse(z):(s.setItem(k,JSON.stringify(d,0,"\t")),d); | |
let store = ( | |
keyOrNS, | |
data, | |
storage = [localStorage, sessionStorage][0], | |
_z = storage.getItem(keyOrNS) | |
) => { |
// Math.sum.js and Math.avg and Math.max and Math.sum -- ALL will automatically flatten (all, args, passed, [[even, [, Arrays]]]) | |
console.log(Math.sum); | |
// undefined | |
console.log(Math.avg); | |
// undefined | |
console.log(Math.max); | |
// ƒ max() { [native code] } |
// randomWithSeed.js - use rnd() after rnd = createRandomWithSeed( seed [0+] = Date.now() ) - Math.random is less than 2x faster than this 'good enough' SEED-able version | |
let createRandomWithSeed = seed => { | |
seed = Math.abs(isNaN(seed) ? Date.now() : seed); | |
return () => { | |
seed = (seed * 9301 + 49297) % 233280; | |
return seed / 233280; | |
}; | |
}; | |
// R=s=>(s=Math.abs(isNaN(s)?Date.now():s),_=>(s=(9301*s+49297)%233280,s/233280)); |
// innerText.js bookmarklet for mobile (to show webpage text contents OR html) (including PARTIAL source of SELECTION) | |
// https://gist.github.com/DarrenSem/7e1216bda80e6269ad53b43d90603158 | |
// 26Sep2024 BUGFIX: now every OTHER section was missed (other than "System instructions") #ThisIsGettingRidiculous #BuildYourOwnPlaygroundIGuess | |
// 4695 char javascript:void function(){"use strict";const a=[]._,b=((a,b,c,e,f,g,d,h)=>(b=new Date(a||Date()),[c,e,,f]=b.toLocaleTimeString().replace(/(a|p)\.(m)\./i,"$1$2").split(/\W/),[,,g,d]=b.toString().split(" "),h=b.toLocaleString().replace(/(\d+)-(\d+)-(\d+)/,"$2/$1/$3").split("/")[0].padStart(2,0),`${c}${e}${(f||"").toLowerCase()} ${d}-${h}-${g}`))(),c=`${""} ${b}`,d=top.document,e=location,f=(a,b)=>(b||d).querySelectorAll(a||null),g=(b,c)=>{const d=b?.[c?"value":q],e=d==a?a:c?d:d.replace(/\n{3,}/g,"\n\n\n").replace(/\n\n/g,"\n");return e},h=a=>a.trim(),j=a=>(a??"").replace(/\nSYNC$/i,"").replace(/ INSTRUCTIONS$/i,""),k=a=>(a??"").toUpperCase(),l=(b,c,d,e,i)=>{let l,m;d |