DEV Community

Peter Vivo
Peter Vivo

Posted on β€’ Edited on

2

Chuck Norris TODO list


pure web, no build, single HTML page, can copy anywhere, reactive, LOC86
Enter fullscreen mode Exit fullscreen mode

Challenge: try break the program by a specific input.

KISS

finally :: handcrafted minify:

                   <!doctypehtml>
        <title>pure web playground</title>
   <script src=https://cdn.tailwindcss.com></script> 
<body class=bg-rose-700><main class="grid min-h-screen
    [perspective:100vw] bg-black place-items-center 
      text-emerald-400"><article class="grid gap-4
      duration-1000 ease-in-out  outline-1
         outline-dashed outline-emerald-300 p-4 
           transition-all" style=transform:rotateX(90deg)>
       <section><p>TODO list<span class="text-sky-300 italic
      text-sm">and more</span><p>instruction:<span class="p-1
  bg-sky-700 text-sky-300">-</span>to add a new item<p class="
text-sky-300 italic text-sm text-right">tested by: Chuck Norris
before was created</section><pre id=monitor></pre><form action
=""><input class="px-4 bg-zinc-800 border-none focus:outline-1
 focus:outline-dashed focus:outline-zinc-300 outline-none py-1
text-zinc-300" maxlength=777 name=todo></form><section><button
 class="p-1 bg-emerald-950 my-2 px-4 rounded" onclick=start()>
   start</button><button class="p-1 bg-emerald-950 my-2 px-4
 rounded" onclick=stop()>stop</button><button class="p-1 my-2
px-4 bg-emerald-950  rounded"onclick="stop(),z.counter=42,rotate
(0)">reset</button><button class="p-1 bg-emerald-950 my-2 px-4
  rounded"onclick=rotate(90*Math.random()|0)>rotate</button>
</section></article></main><script>const signal=(t=(()=>{}))=>
e=>new Proxy(e,{get:(t,e)=>t[e],set:(e,o,n)=>(e[o]=n,t(e,o,n),
!0)}),elMonitor=document.getElementById("monitor"),monitor=t=>
elMonitor.innerText=JSON.stringify(t,null,2);let bum,z=signal(
monitor)({pure:"web",counter:42});const stop=()=>clearInterval
 (bum),start=()=>{clearInterval(bum),bum=setInterval((()=>z.
counter++))},textInput=document.querySelector('[name="todo"]')
;textInput.addEventListener( "input",(t=>{z.todo=t.target.value
     .split("-"),z.length=z.todo.length,rotate(90*Math
        .random()|0)}));const rotate=t=>setTimeout
         ((()=>{document.querySelector("article")
             .style.transform=`rotateX(${t}deg)
               `}),200);rotate(0)</script>
Enter fullscreen mode Exit fullscreen mode
πŸ‘‹ While you are here

Reinvent your career. Join DEV.

It takes one minute and is worth it for your career.

Get started

Top comments (0)

typescript

11 Tips That Make You a Better Typescript Programmer

1 Think in {Set}

Type is an everyday concept to programmers, but it’s surprisingly difficult to define it succinctly. I find it helpful to use Set as a conceptual model instead.

#2 Understand declared type and narrowed type

One extremely powerful typescript feature is automatic type narrowing based on control flow. This means a variable has two types associated with it at any specific point of code location: a declaration type and a narrowed type.

#3 Use discriminated union instead of optional fields

...

Read the whole post now!

πŸ‘‹ Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay