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

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

Iterative Square Root

  1. //------------------------------------------------------------------
  2. float function_IterativeSquareRoot (float x) {
  3.   // http://en.wikipedia.org/wiki/Methods_of_computing_square_roots
  4.   // Ancient Babylonian technology
  5.   functionName = "Iterative (Heron's) Square Root";
  6.   float y = 0.5; 
  7.   int n = 6;
  8.   for (int i=0; i<n; i++) {
  9.     y = (y + x/y)/2.0;
  10.   }
  11.   return y;
  12. }

Was browsing some code by Golan Levin and stumbled on this…

There are some real gems in the repo – might port some stuff from there in the future…

MYSQL Select Rows in Random Order

  1. SELECT * FROM `table` ORDER BY `field` RAND();
// mysql // tricks

SVG Set Tag MDN

  1. document.body.innerHTML = `
  2. click the rounded rect<br>
  3. <svg viewBox="0 0 10 10" width="150" height="150">
  4.   <style>
  5.     rect { cursor: pointer }
  6.     .round { rx: 5px; fill: green; }
  7.   </style>
  8.  
  9.   <rect id="me" width="10" height="10" rx="3">
  10.     <set attributeName="class" to="round" begin="me.click" dur="2s" />
  11.   </rect>
  12. </svg>
  13. `

This is from MDN. Having never seen or used the set tag before, I thought this was worth a quick post…

// javascript // svg // tricks // ui

Multiple Class Trick

  1. .thing.thing.thing {
  2.   color: green;
  3. }
  4.  
  5. .thing.thing {
  6.   color: red;
  7. }
  8.  
  9. .thing {
  10.   color: blue;
  11. }

What color would p.thing be?

// css // tricks // ui
snippet.zone ~ 2021-22 /// {s/z}