Very Bad JavaScript 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)
}
}
}
}
}
}
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
Iterative Square Root
//------------------------------------------------------------------
float function_IterativeSquareRoot (float x) {
// http://en.wikipedia.org/wiki/Methods_of_computing_square_roots
// Ancient Babylonian technology
functionName = "Iterative (Heron's) Square Root";
float y = 0.5;
int n = 6;
for (int i=0; i<n; i++) {
y = (y + x/y)/2.0;
}
return y;
}
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…
SVG Set Tag MDN
document.body.innerHTML = `
click the rounded rect<br>
<svg viewBox="0 0 10 10" width="150" height="150">
<style>
rect { cursor: pointer }
.round { rx: 5px; fill: green; }
</style>
<rect id="me" width="10" height="10" rx="3">
<set attributeName="class" to="round" begin="me.click" dur="2s" />
</rect>
</svg>
`
This is from MDN. Having never seen or used the set
tag before, I thought this was worth a quick post…
Multiple Class Trick
.thing.thing.thing {
color: green;
}
.thing.thing {
color: red;
}
.thing {
color: blue;
}
What color would p.thing
be?