9 ms·
Dwitter – A social network for short JavaScript demos
- huangc10 10y agoI enjoy the matrix theme falling letters (4th on the top-sorted list). Thanks!
- russellbeattie 10y agoThis is definitely fun... It'd be nice if it used Github to login and save to Gists. Also, I think it'd be better if the developer called u(t){}, rather than it being the content of the entire post, so it could set up variables, etc., and since it already has a few shortcuts like c,x,C,S,T,R, might as well add in a more complete API.
- mstade 10y agoJust set something on `this`: if (!this.mySettings) { this.mySettings = { value: 1 } }
- russellbeattie 10y ago140 character limit, so that wastes like 60 of it. :-)
- mstade 10y agoAh, didn't realize, my bad! It's doable in fewer characters of course, but still a waste. Funny, I thought it was just a bit odd how terse some of these demos were, but given the 140 char limit that I somehow didn't notice at all it makes more sense.
- franciscop 10y agoI thought the same until I tried it and realized of the 140char limitation, which really limits what you can do
- partisan 10y agoThank you for this. It definitely stimulated my imagination and creativity.
- ohhhwell 10y agoOh fun, didn't expect to see my side-project here :) A few of my personal favorites: https://www.dwitter.net/d/90 https://www.dwitter.net/d/90 https://www.dwitter.net/d/406 https://www.dwitter.net/d/406 https://www.dwitter.net/d/433 https://www.dwitter.net/d/433 https://www.dwitter.net/d/617 https://www.dwitter.net/d/617
- Lionleaf 10y agoDidn't mean to post with that account. Oh well.
- NKCSS 10y agoI love https://www.dwitter.net/d/739 https://www.dwitter.net/d/739
- zamalek 10y agoA little feedback, the tab got helluva laggy after scrolling down a few pages. I assume that's because you aren't unloading dwitters when they scroll past the top of the viewport - which you probably should. Chrome 56, Windows 10.
- Lionleaf 10y agoThe dweets are stopped but not unloaded as you scroll away. You're entirely right though, needs some proper unloading. Edit: Link to the issue https://github.com/lionleaf/dwitter/issues/66 https://github.com/lionleaf/dwitter/issues/66
- dorianm 10y agoInfinite loops (accidental in my case) should probably be catched in some way.
- brian_cloutier 10y agoYeah, the halting problem has been around since 1936. You'd think someone would have solved it already!
- sigvef 10y agoThe source is on GitHub: https://github.com/lionleaf/dwitter https://github.com/lionleaf/dwitter \o/
- franciscop 10y agoWoah, this is awesome but a bit misleading in the beginning. I spend my last 15 min trying it out: https://www.dwitter.net/d/702 https://www.dwitter.net/d/702
- tuanx5 10y agoNeat concept. It reminds me of the Wolfram One-Liner competition http://blog.wolfram.com/2016/11/09/the-2016-wolfram-one-liner-competition-winners/ http://blog.wolfram.com/2016/11/09/the-2016-wolfram-one-line...
- modeless 10y agoIn a similar style, but with WebGL: https://www.shadertoy.com https://www.shadertoy.com
- andrew3726 10y agoYup, pretty similar but the limitation to plain JS and to 140 chars makes the code more fun :)
- jacmoe 10y agoThe idea is much, much better than the name :)
- kowdermeister 10y agoI'd appreciate for not auto running the demos. The fractal animation lagged whole page down to 5FPS.
- mutable 10y agoJust tried to register with username @H2O. Sent post request, after that got 500 error.
- Lionleaf 10y agoOh, got the 500 error dump. It's the @ in your username, that'll teach me. For now avoid special characters in your username ;) Edit: In case you were stuck in a 500-loop I quickly changed your username to H2O, hopefully it works now
- yokisan 10y agoOpened page: this is kinda lam....oooh that's neat. * scroll scroll scroll * Nice work.
- artursapek 10y agoThis is the coolest website I've seen in a long time. Awesome idea. EDIT: one issue I'm running into is it's easy to accidentally write half-finished code that freezes my browser. It would be nice to have an option to only refresh the preview upon clicking some kind of button.
- sigvef 10y agoOne trick you learn as a dweeter is to write all for-loops as "fr" instead of "for", and then only adding the last "o" when you feel confident that the loop won't accidentally go on forever!
- jlebrech 10y agoor the source box could replace 'for' with a loop thats designed to run a few seconds.
- Lionleaf 10y agoSorry about your lost dweet :( Accidental infinite loops while editing can be a pain. A "reload" button isn't a bad idea, or a "recover dweet draft" functionality.
- artursapek 10y agoI managed to finish one! https://www.dwitter.net/d/714 https://www.dwitter.net/d/714 More suggestions: - in-browser minification tool - character counter would count using this output - larger textarea That way, I can compose without relying on vim + yui-compressor. Awesome little site.
- Lionleaf 10y agoBrilliant dweet! Part of the challenge is the manual minification. A larger textarea might be worth it especially as you can use linebreaks instead of ; for better readability
- ihuman 10y agoWhat resources to people recommend for learning about animating in canvas tags like on Dwitter? I'm already familiar with Javascript, but seeing what people are able to do here with 140 characters amazes me.
- simooooo 10y ago12 hours until twitter name infringement
- a13n 10y agoName does not pass bar test.
- ethana 10y agoThis kills the Firefox.
- salik_syed 10y agoThis reminds me a bit of ShaderToy -- very cool :)
- rosalinekarr 10y agoThis is really cool, but executing other people's javascript in a page makes me nervous. What sort of restrictions are in place to prevent malicious exploits?
- Lionleaf 10y agoMakes me quite nervous too. So far each dweet is run in a sandboxed iframe loaded from a separate subdomain. There are definitely things you can do, and I'm aware of some annoying ones. I'll just manually delete them at this point. Any security conscious person would view it with noscript and just read the javascript ;)
- e5an 10y agoWhile you're manually deleting things... there are currently way too many that are just exact reposts of the default swaying black bars. Probably accidents rather than people being deliberately lame, but low-hanging fruit for any kind of automatic cleanup.
- zeta0134 10y agoWhile you're deleting stuff, I noticed someone on the new page has posted pornographic images. Alas, I'm not terribly surprised since this is the internet after all, but I'll +1 a feature to report dweets as being inappropriate. A system to automatically hide dweets (for later manual review) after receiving a certain number of reports would likely solve the problem in the short term.
- EGreg 10y agoWhy not make their javascript run in WebWorkers and provide a DOM-like interface for all the things? That way you can kill infinite loops etc.
- Lionleaf 10y agoThat's something I've been thinking about. Webworkers don't have direct access to the Canvas though, but it seems like you can work around that by passing image data. Killing infinite loops would be great
- mypalmike 10y agoPrior art: https://t.d3fc.io/ https://t.d3fc.io/
- Lionleaf 10y agoOh, that's cool! I like the integration with twitter
- Retr0spectrum 10y agoHow 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<h;i++)for(j=0;j<w;j++)d.data[(i*w+j)*4+3]=(i-j&j+i)*t%w;x.putImageData(d,0,0) Does anyone know how it works?
- Smerity 10y agoThere's a share button on each of the "tweets" at least on my screen. The direct link to the Sierpinski triangle inspired animation you're noting is below: https://www.dwitter.net/d/676 https://www.dwitter.net/d/676
- deleted 10y ago[deleted]
- mxfh 10y agoI 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 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-manipulation-with-typed-arrays/ https://hacks.mozilla.org/2011/12/faster-canvas-pixel-manipu...
- yev 10y agoCheck out my dweet :) https://www.dwitter.net/d/734 https://www.dwitter.net/d/734
- russellbeattie 10y agoSo I whipped up a standalone HTML page to use to develop Dwitter scripts without having to use their interface (which seems prone to crashing). Here's the source: https://gist.github.com/russellbeattie/ef27709f7c916ea54454cbc3866d4d2f https://gist.github.com/russellbeattie/ef27709f7c916ea54454c... and you can see it live on my site: http://www.russellbeattie.com/dwitterish.html http://www.russellbeattie.com/dwitterish.html Interestingly, I found that some scripts really don't like using eval(), so I modified the page to dynamically swap in new <script> elements with the code instead, and a flag to go back and forth. Here's an example of a script which doesn't like eval() - it runs noticeably faster when embedded in a script: https://www.dwitter.net/d/697 https://www.dwitter.net/d/697 Edit: Added the ability to just embed the code in the URL: http://www.russellbeattie.com/dwitterish.html#c.width%7C%3D0%3Bfor(n%3D200%3Bn-%3D1%2F64%3Bx.fillRect(n%253*666%2Cn*5%2Ch%3D8-k%2Ch))for(r%3DC(t*3)%2Ci%3DS(t*4)%2Ck%3D28%3B--k%2Fr%3Bi%3Dj)j%3D2*r*i%2B1-n%2F99%2Cr%3Dr*r-i*i%2B1-n%253 http://www.russellbeattie.com/dwitterish.html#c.width%7C%3D0... (Note that I only tested this on Chrome, so feel free to modify if there's issues.)
- kornish 10y agoThis is cool! You should consider submitting a patch back upstream with that script embedding improvement.
- sigvef 10y agoWe've gone full circle! This thing started as a stand-alone HTML page for dweets with ability to embed the code in the URL: http://arkt.is/t http://arkt.is/t (hover to show editor). GitHub: https://github.com/sigvef/arktis-tweet-demo https://github.com/sigvef/arktis-tweet-demo . Here it is with the same dweet embedded: http://arkt.is/t/Yy53aWR0aHw9MDtmb3Iobj0yMDA7bi09MS82NDt4LmZpbGxSZWN0KG4lMyo2NjYsbio1LGg9OC1rLGgpKWZvcihyPUModCozKSxpPVModCo0KSxrPTI4Oy0tay9yO2k9ailqPTIqcippKzEtbi85OSxyPXIqci1pKmkrMS1uJTM= http://arkt.is/t/Yy53aWR0aHw9MDtmb3Iobj0yMDA7bi09MS82NDt4LmZ... . Incidentally, this is where the "dwitter" name came from: "demos" as in the demoscene (https://en.wikipedia.org/wiki/Demoscene https://en.wikipedia.org/wiki/Demoscene) and twitter.
- elliottcarlson 10y agoThis is awesome! During one of the last hackathons I participated while at Tumblr, I made a Processing post type, that allowed people to have interactive posts using Processing code, and could be reblogged with edits - very much like this. Love seeing something similar to this idea!
- gillianlish 10y agowithin a half hour of playing around on this site, someone posted goatse. and there is no way to report, hide, downvote, etc.
- sunilkumarc 10y agoI'm not understanding this. How is animation happening? What is S(t)? Can somebody please explain this project?
- minitech 10y agoScroll down: u(t) is called 60 times per second. t: elapsed time in seconds. c: A 1920x1080 canvas. x: A 2D context for that canvas. S: Math.sin C: Math.cos T: Math.tan R: Generates rgba-strings, ex.: R(255, 255, 255, 0.5)
- recursive 10y agoEnded up with something totally different than what I was going for. This is fun. https://www.dwitter.net/d/778 https://www.dwitter.net/d/778
- EGreg 10y agoI kind of love it! Are they all in iframes?
- andrew3726 10y agoYup, 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 https://news.ycombinator.com/item?id=13702021 [1] https://github.com/lionleaf/dwitter/blob/master/dwitter/templates/snippets/dweet_card.html#L6 https://github.com/lionleaf/dwitter/blob/master/dwitter/temp...
- jaimehrubiks 10y agoMy MacBook Air is complaining after a few minutes of reading this site.