Golfed Codepen – 3D Spiral Thing
copy // sort of golfed version of https://www.instagram.com/p/C1uv6Kqv19T/ // by @mewtru b = document.body a = Object .assign a( b.style , { background: '#000' , color: '#fff' } ) w = 'snippet.zone snippet.zone' .toUpperCase ( ) .split `` F = ( n, O = 0 , C, S, o, t) => { b.innerHTML += `< div id= ${ n} style= 'position:absolute;left:50%;top:50%;translate:-50% -50%;width:100% text-align:center;white-space:nowrap' ></ div> ` w.map ( l => this [ n] .innerHTML += `< span style= 'display:inline-block;margin-right:5px;font-size:28px' > ${ l} </ span> `) t = O setInterval( _ => { t += .005 ; [ ...this [ n] .children ] .map ( ( e, i) => { T = t + i / 2.7 a( e.style , { translate: `0 ${ Math .sin ( T) * 100 } px`, scale: Math .cos ( T) * .5 + .5} ) } , 16 ) } ) } F( 'Z' ) F( 'X' , 3 )
Try it out…
“Very cool” pen by Lucas Fernando that comes from @mewtru
I decided to do a speed-coded semi-golfed version… can definitely be way more golfed 😀
Random Color Strings
copy R = Math .random b = document.body b.style = 'background: black; font-family: sans-serif; text-transform: uppercase; color: white;' setInterval( _ => { if ( R( ) < .9) { s = '' for ( i= 0 ; i< R( ) * 30 + 4 ; i++ ) s+= ( ~~( R( ) * 0xff) ) .toString ( 36 ) .replace ( R( ) < .9 ? /[0-9]/g : '' , '' ) b.innerHTML += ` < n style= "color:hsl(${R()*360}, 30%, 50%)" > ${ s} </ n> `+ ( R( ) < .1? '<br>' : '' ) ; } } , 100 )
Try it out…
Make some random strings and give them a random color… a friend of mine showed a work in progress forked codepen – so I created a golfed version/variation…
Building Spikes Codegolf
copy f = n=> ` ^ /| \\ / .| .\\ / ..| ..\\___`.replace ( /.[_|^]./g , '$&' .repeat ( n) ) + '____' // test it out document.body .innerHTML += `< pre> ${ f( 1 ) } ${ f( 3 ) } ${ f( 4 ) } `
Try it out…
Great codegolf stackexchange answer from user tsh
Fibonacci Triangle Golfed
copy // by Arnauld - https://codegolf.stackexchange.com/users/58563/arnauld f= ( n, a= b= 1 , p) => n? '' .padEnd ( p) + a+ `+ ${ b} = ${ b+= a} `+ f( n- 1 , b- a, ( a+ "" ) .length - ~p) : '' console.log ( f( 20 ) )
Try it out…
Great golfed solution to this question at codegolf stackexchange by user Arnauld
Alphabet Array Golfed
copy l= [ ] for ( i= 26 ; i--; ) l[ i] = ( 10 + i) .toString ( 36 ) console.log ( l)
Try it out…
A nasty golfed way to fill an array with letters a-z.
I usually do (as seen in another post ):
copy let letters = 'abcdefghijklmopqrstuvwxyz' .split ``