)
}
}
)
(
}
{
)
)
(
)
(
(
{
}
)
(
)
}
)
)
{
(
(
)
)
}
)
(
}

Bad JavaScript Poem

  1. with (self) with (Math){ typeof self
  2. with (window) with (sin) if (true) self }

This could be dangerous. Bad js poetry:

With self With Math Type of self With window With sin If true self

:/

// humor

Very Bad JavaScript Poem

  1. if (window . i) {
  2.   if (window . you) {
  3.     if (window . we) {
  4.       with (window . blue) {
  5.         for ( window . what in window . how ) {
  6.           for ( window . how in window . who ) {
  7.             do {} while (true)
  8.           }
  9.         }
  10.       }
  11.     }
  12.   }
  13. }

Bad js poem:

if window i if window you if window we with window blue for window what in window how for window how in window who do while true

// humor

Random Color Strings Not-Golfed

  1. const { random, round } = Math
  2.  
  3. const TICK = 100
  4. const CHUNKS_PER_TICK = 4
  5. const minChunk = 3
  6. const maxChunk = 10
  7. const diffChunk = maxChunk - minChunk
  8.  
  9. const generateChance = .9 // 90% change of string generation
  10. const spaceChance = .8 // 80% chance of space
  11. const breakChance = .1 // 10% chance of line break
  12. const numbersChance = .9
  13.  
  14. const randomChunk = () => round(random() * 0xff).toString(36)
  15.   .replace(random() < numbersChance ? /[0-9]/g : '', '')
  16.  
  17. setInterval(() => {
  18.  
  19.   if (random() < generateChance) {
  20.  
  21.     Array(CHUNKS_PER_TICK).fill(0).forEach(() => { 
  22.  
  23.       const stringLeng = round(minChunk + random() * diffChunk)
  24.       let chunk = ''
  25.  
  26.       Array(stringLeng).fill(0)
  27.         .forEach(() => chunk += randomChunk())
  28.  
  29.       const span = document.createElement('span')
  30.       const hue = round(random() * 360)
  31.  
  32.       span.style.color = `hsl(${hue}, 30%, 50%)`
  33.       document.body.appendChild(span)
  34.       span.innerText = chunk
  35.  
  36.       if (random() < spaceChance) { 
  37.         document.body.appendChild(document.createTextNode(' '))
  38.       }
  39.  
  40.       if (random() < breakChance) {
  41.         const br = document.createElement('br')
  42.         document.body.appendChild(br)
  43.       }
  44.  
  45.     })
  46.   }
  47.  
  48.   scrollTo(0, document.body.scrollHeight)
  49. }, TICK)
  50.  
  51.  
  52. // just a lazy hack since snippet zone quick editor only supports js...
  53. // normally this goes in a separate file... :D
  54. document.body.innerHTML += `
  55. <style>
  56. body, html {
  57.   background: black;
  58.   font-family: Oswald, sans-serif;
  59.   overflow-wrap: break-word;
  60.   text-transform: uppercase;
  61.   letter-spacing: 1;
  62. }
  63.  
  64. br {
  65.   height: 1em;
  66.   display: block;
  67. }
  68. </style>
  69. `

An expansion on a snippet from a few days ago inspired by a friends codepen fork…

W3Schools Output Tag

  1. <!-- from w3schools.com -->
  2. <!DOCTYPE html>
  3. <html>
  4. <body>
  5.  
  6. <h1>The output element</h1>
  7.  
  8. <form oninput="x.value=parseInt(a.value)+parseInt(b.value)">
  9. <input type="range" id="a" value="50">
  10. +<input type="number" id="b" value="25">
  11. =<output name="x" for="a b"></output>
  12. </form>
  13.  
  14. <p><strong>Note:</strong> The output element is not supported in Edge 12 (or earlier).</p>
  15.  
  16. </body>
  17. </html>

I like w3Schools.

This code has some problems… but… for a cool little snippet to play with – I think that’s ok. SnippetZone certainly has tons of things like this…

Proxy Constants

  1. const spec = {
  2.   get(o, key) { 
  3.     return o[key] != null ? 
  4.       o[key] : o[key] = Objector()
  5.   }
  6. };
  7.  
  8. const Objector = () => new Proxy({}, spec);
  9.  
  10. const events = Objector();
  11.  
  12. events.graphics.RENDERED;
  13. events.graphics.ERASED;
  14. events.ui.LOADING;
  15. events.ui.LOADED;
  16. events.files.OPENED;
  17. events.files.CLOSED;
  18.  
  19. const { ERASED } = events.graphics;
  20. console.log('a', ERASED === events.graphics.ERASED);
  21. console.log('b', ERASED === events.files.CLOSED);

This is somewhat evil… I’ve never liked these java style constants. Maybe I’ll write up a detailed alternative method some time.

// humor // proxies // tricks
snippet.zone ~ 2021-24 /// {s/z}