Live data from Hacker News

Dwitter – A social network for short JavaScript demos

dwitter.net

71–74 of 74 posts

Re: Dwitter – A social network for short JavaScript demos

#71
post #55

I kind of love it! Are they all in iframes?

Yup, as confirmed by the author[0]. Also, it's opensource, 'dweet card' template shows that it uses iframes[1].

[0] https://news.ycombinator.com/item?id=13702021

[1] https://github.com/lionleaf/dwitter/blob/master/dwitter/temp...

Re: Dwitter – A social network for short JavaScript demos

#72
post #62

Earlier quoted context omitted.

Infinite loops (accidental in my case) should probably be catched in some way.

Yeah, the halting problem has been around since 1936. You'd think someone would have solved it already!

if (time_elapsed > some_arbitrary_threshold) { interrupt_sandboxed_code(); }

Re: Dwitter – A social network for short JavaScript demos

#74

How do I link to a specific post? This one by mxfh looks very cool: d=x.getImageData(0,0,w=c.width=256,h=144);for(i=0;i Does anyone know how it works?

I don't know either, was more of an accident and I ran for it. But I'll try:

Manipulating the canvas Imagedata TypedArray is usually faster than draw calls like fillRect; yet the getImagadata-setImagedata and 2D-Y-X-iteration (here ij) fluff doesn't leave much bytes for actual per pixel operations.

    (i*w+j)*4+3 // is the alpha channel (offset of 3) index of the pixel in the Imagedata
The actual payload:

    (i-j&j+i)*t%w
Translates to

    (y - x & x + y) * time % 256
With 255 resulting in Black rgba(0,0,0,1) to transparent black rgba(0,0,0,0), which is then effectively viewed as background color, in this case white.

see https://www.dwitter.net/d/661 for an earlier full RGBA example

Before WebGL this was the fastest way to get stuff done in the canvas: https://hacks.mozilla.org/2011/12/faster-canvas-pixel-manipu...

Post reply on HN