Obfuscated Pseudo-typed Globals
copy number: age = 33 ; number: height = 6 ; string: name = 'joe' ; object: person = { name, age, height } ; console.log ( person) ;
Try it out…
WARNING: do not use this
This one is bad enough that I feel the need to put a warning. This is some weird obfuscation… I’ve put labels before global variable definitions so they look like type declarations.
It’s funny, monaco says lots of stuff about this one if you hit the Try it out… button you can see…
Obfuscated Pre
copy b = document.body with( b.style ) fontFamily = 'monospace' , fontSize = '2em' , transform = 'skew(10deg) translateX(40px)' N = '<br>' ; ( f= ( _= '*' ) => ( b.innerHTML += ` < b style= 'opacity:${Math.random()+.2}' > ${ _} </ b> `, f) ) ( '<pre>' ) ( ) ( ) ( ) ( ) ( N) ( '(' ) ( '0' ) ( '_' ) ( '_' ) ( N) ( '-' ) ( ) ( ) ( '-' ) ( N) ( '_' ) ( '_' ) ( '0' ) ( ')' ) ( N) ( '-' ) ( ) ( ) ( '-' ) ( N) ( '(' ) ( '0' ) ( '_' ) ( '_' ) ( N) ( '-' ) ( ) ( ) ( '-' ) ( N) ( '_' ) ( '_' ) ( '0' ) ( ')' ) ( N) ( '-' ) ( ) ( ) ( '-' ) ( N) ( '(' ) ( '0' ) ( '_' ) ( '_' ) ( N) ( ) ( ) ( ) ( )
Try it out…
Not really sure what this is… just playing around…
Flower of Life Canvas
copy ( ( d = document, b = d.body , rad = ( innerWidth * 1.9 ) / 6 , theta = 0 , thetaSpeed = 0.03 , cx = innerWidth / 4 , cy = innerHeight / 4 , ox = 0 , oy = 0 , offTheta, x, y, ang, step, blur, _ ) => { Object .assign ( b.style , { background: 'black' , margin: 0 } ) blur = Object .assign ( d.createElement `canvas`, { width: innerWidth * 2 , height: innerHeight * 2 } ) .getContext `2d` with ( Math ) { with ( b.appendChild ( Object .assign ( d.createElement `canvas`, { width: innerWidth * 2 , height: innerHeight * 2 } ) ) .getContext `2d`) { Object .assign ( canvas.style , { width: '100%' , height: '100%' } ) onresize = ( ) => { blur.canvas .width = canvas.width = innerWidth * 2 blur.canvas .height = canvas.height = innerHeight * 2 rad = ( innerWidth * 2.5 ) / 6 cx = innerWidth cy = innerHeight fillStyle = '#000' fillRect( 0 , 0 , canvas.width , canvas.height ) } onresize( ) step = ( PI * 2 ) / 6 _ = t => { ang = ~~( t / 500 ) % 7 globalAlpha = 0.23 fillStyle = '#fff' if ( ang > 0 ) { offTheta = step * ang ox = rad * cos( offTheta) oy = rad * sin( offTheta) } else { ox = 0 oy = 0 } for ( i = 0 ; i < 20 ; i++ ) { x = ox + cx + rad * cos( theta) y = oy + cy + rad * sin( theta) theta += thetaSpeed fillRect( x, y, 4 , 4 ) } blur.drawImage ( canvas, 0 , 0 ) globalAlpha = 0.05 drawImage( blur.canvas , 0 , 2 ) requestAnimationFrame( _) } _( ) } } } ) ( )
Try it out…
Speed coded animated flower of life on canvas
Array Sum Golfed
copy a = [ 1 , 2 , 3 , 6 , 9 ] ; sum = eval( a.join `+ `) ; console.log ( sum) ;
Try it out…
Found myself doing something like this a few times… easy golfed array sum. I saw this over at codegolf stackexchange here .
That whole thread is a great. I plan to post more from there in the future.
toString Hack Obfuscated
copy x= '' + self j= '' 'd1d7a1712345691a7512d427b1da7d9ab7519a4b721a961721d694' .split `` .map ( _=> j+= `x[ 0x${ _} ] + `) console.log ( eval( j+ '""' ) )
Try it out…
Yesterday’s snippet saying something else…
It’s simpler than it looks:
copy x= '' + self // becomes "[object Window]" j= '' // initialize `j` which will be javascript to pass to `eval` 'd1d7a17123456...' // this is a list of index values to // look up in `x` in hexidecimal so that each // index is a single character .split `` // split the index values into an array `[0xe, 0x2 ...` .map ( _=> j+= `x[ 0x${ _} ] + `) // map over the index values and write a string like // this `x[0xe]+x[0x2]+...` into `j` console.log ( eval( j+ '""' ) ) // evaluate `j` with an empty string at the end // `x[0xe]+x[0x2]+""` and log it out
`