Live data from Hacker News

An HTML/CSS/JS code editor in 230+ bytes

xem.github.io

21–30 of 57 posts

Re: An HTML/CSS/JS code editor in 230+ bytes

#21
post #20

Nice and you could probably make it save in under 512 bytes. Just persist everything to localStorage like the tiny spreadsheet http://jsfiddle.net/ondras/hYfN3/ Or save everything on the URL so it can be bookmarked too.

Yes, saving to URL would make this also shareable , so it would become real 'self contained Codepen' :] I've made something in this manner recently: http://tinyurl.com/selfcontained-editable-datauri

I like this idea!

Feel free to fork miniCodeEditor and add this kind of features :)

Re: An HTML/CSS/JS code editor in 230+ bytes

#22
post #16

Earlier quoted context omitted.

The clever part here is that it's defined as: for(i=4;i--;) instead of the more common (off by one?) for(i=4; i > 0; i--) syntax

That is clever.

I recommend reading K&R (http://en.wikipedia.org/wiki/The_C_Programming_Language) if you haven't already. It's got all sorts of elegant tricks like this. But of course it depends on very particular implementation details at times.

Re: An HTML/CSS/JS code editor in 230+ bytes

#23
post #10

Clever! Use of `i--` in loop for condition check wasn't intuitive at first. Apparently `i--` will return the current value of i (before decrementing).

Not intuitive? What do you think a post-decrement does do if not that?

A lot of people forget (or never knew) that the increment and decrement operators return a value as well as affecting the target variable, and that you can put what-ever you like in the iteration end control portion of a for statement as long as it returns truey/falsey.

Re: An HTML/CSS/JS code editor in 230+ bytes

#24
post #22

Earlier quoted context omitted.

That is clever.

I recommend reading K&R ( http://en.wikipedia.org/wiki/The_C_Programming_Language ) if you haven't already. It's got all sorts of elegant tricks like this. But of course it depends on very particular implementation details at times.

Don't worry, I have (hence my disbelief at the first comment). Funny we've come full circle (via e.g. Java) back to the point where that is valid code.

Re: An HTML/CSS/JS code editor in 230+ bytes

#29

Awesome. I love small things. In fact, I created a CSS library, min, that's 995 bytes - http://minfwk.com/ .

Amazing how much you wedged into 995 bytes. I have to admit, I would have been willing to pay 997 or 988 bytes for it, but I'm a big spender ;-)
Post reply on HN