News for hackers. Stuff that matters.
Re:Scrub values in JavaScript live by pbiggar on Wednesday November 28, 2012 @03:24AM (#4841549)
This is very impressive and cool. However I really don't think that parsing source code and manipulating is a very maintainable way to do this (and this as someone who writes Clojure for a living).

You could do exactly the same using very simple Knockout. It wouldn't be as funky, but it would be something you'd be happy to use in production.

Re:Scrub values in JavaScript live by mutewinter on Wednesday November 28, 2012 @07:28AM (#4842174)
I did something like this in my presentation[1] about Ember.

It uses Ember.js to maintain the state of the code samples and proved to be very stable. I don't have interactive sliders on specific values, but the code is parsed and run after every character the user types. e.g. you can change the size of the squid on this page[2] and see it reflected immediately on the right.

[1]: http://mutewinter.github.com/why_ember/#/slides

[2]: http://mutewinter.github.com/why_ember/#/slides/data-binding

Re:Scrub values in JavaScript live by nornagon on Wednesday November 28, 2012 @03:26AM (#4841558)
It isn't really intended for production use. Personally, I plan to use it to tweak values in games I write, because having to alt+tab, find, edit, alt+tab, refresh, restore state for every tiny tweak to the position of a UI element sucks.

This is a development tool :)

Re:Scrub values in JavaScript live by pbiggar on Wednesday November 28, 2012 @03:32AM (#4841573)
Can you go into more detail?
Re:Scrub values in JavaScript live by mirashii on Wednesday November 28, 2012 @03:53AM (#4841628)
I would highly recommend watching this, and keeping in mind how such a thing could be useful in games.

http://worrydream.com/#!/InventingOnPrinciple

For a concrete example of usefulness in games, see

http://www.youtube.com/watch?v=-32SFFbaeJg

Re:Scrub values in JavaScript live by pbiggar on Wednesday November 28, 2012 @04:04AM (#4841651)
It would be useful to give a pitch as to why I should watch it - it's an hour long.
Re:Scrub values in JavaScript live by bjourne on Wednesday November 28, 2012 @04:52AM (#4841757)
Because it's an awesome lecture and well worth a good hour of your life. Trust us on this one, but it's your loss if you don't. :)
Re:Scrub values in JavaScript live by spicyj on Wednesday November 28, 2012 @04:10AM (#4841671)
If it helps, you can read the comments from when it was posted and got 221 points:

http://news.ycombinator.com/item?id=3591298

Re:Scrub values in JavaScript live by cocoflunchy on Wednesday November 28, 2012 @05:00AM (#4841776)
It's really one of the best ways you can spend an hour imho.
Re:Scrub values in JavaScript live by nornagon on Wednesday November 28, 2012 @03:47AM (#4841613)
What would you want to use it for in a production environment? (and why is JS source transformation not viable there?)