1,026 karma · joined Dec 11, 2011 (14y ago) · 464 submissions
comment 10y ago · link · parent
http://httparchive.org/interesting.php
Be sure to pick the most suitable format and to optimize your images. You can also try to serve WebP to browsers which support it. When it replaces JPEG, you save about 30%. With PNG8, it's somewhere between 5 and 50%. And with PNG32, if you substitute it with a lossy WebP, easily 80%.
Scripts come 2nd with ~363 KB. ES6's will thankfully help with that. Creating the structure of your application declaratively enables better tooling. Not only does this make your editor a lot smarter, it also paves the way for tree-shaking.
If you tree-shake your application, only the actually used library features will be included in the shipped bundle.
comment 10y ago · link · parent
The problem is highlighted by the images in this article:
http://jandemooij.nl/blog/2015/11/27/math-random-and-32-bit-...
comment 10y ago · link · parent
TypeScript is pretty popular and it does work really well. Writing larger applications in a team is much easier if there is tooling to assist you. With most projects, about 80% of the work is maintenance and tooling does immensely help with that.
comment 10y ago · link · parent
Actually, adding the bare minimum of type annotations (fields & function signatures) and type casts (e.g. casting whatever you get from querySelector into the concrete type of element) results in fewer key presses, because you can auto-complete everything and because you get additional machine-assistance like call tips and type checks.
So, you'll be actually faster if you add some types. Type inference does cover quite a lot. In practice, you'll need very few annotations and casts.
This Dart demo, for example, only needed a single type cast to be fully typed:
comment 11y ago · link · parent
You don't make that kind of error in other case-sensitive languages which offer better tooling.
E.g. you start writing "canv" and auto-complete that to "CanvasElement". You just auto-complete everything. And if you actually do screw something up, you get a squiggly line and a hint.
Simply ignoring all kinds of errors does not make the language easier to use. In JavaScript, for example, there are many cases where semicolons can be omitted. However, they aren't actually optional. There is a list of exceptions. It didn't actually make the language any easier.
Another example are things which should be type errors (`'foo' - 123` and so forth), but you get NaN instead. Or when you go outside some array's bounds you just get undefined instead of an exception. This stuff does not make the language easier to use.
comment 11y ago · link · parent
https://github.com/mahonnaise/vs-code-markdown-theme
The automatic table formatting was pretty cool though (even if it's purely cosmetic).
comment 11y ago · link · parent
AltGr is still broken. The problem has been known for almost 2 years and there are about a hundred duplicates.
https://github.com/atom/atom-keymap/issues/35
If you aren't using an US keyboard layout, this might be a problem.
comment 11y ago · link · parent
'x: $x, y: $y'
is a lot easier to type than: 'x: ' + x + ', y: ' + y
I actually had to triple check that line. Concatenation is very error-prone. I often mess it up.String interpolation is a fairly popular feature nowadays:
comment 11y ago · link · parent
import 'dart:async';
import 'dart:io';
main() {
var file = new File('/sys/class/leds/beaglebone:green:usr0/brightness');
var state = 0;
new Timer.periodic(new Duration(seconds: 2), (_) {
state = 1 - state;
file.writeAsStringSync('0$state', flush: true);
});
}
While it's not the most concise version, it's certainly very readable. Everyone can clearly see that the duration is 2 seconds and that that boolean flag is for flushing, because that's exactly what the code says.comment 11y ago · link · parent
Most web fonts don't look that nice on Windows. Windows heavily relies on hinting and doing this properly is a lot of hard mind-numbing work.
Most web fonts also aren't that readable. Sure, your wide/thin/square font looks very modern and stuff, but it's not as readable as a Verdana or Arial. When I visit your site, I'm there for the text, not the font.
comment 11y ago · link · parent
You also have access to part of this functionality via the non-standard drawWindow method:
https://developer.mozilla.org/en-US/docs/Web/API/CanvasRende...
comment 11y ago · link · parent
In modern browsers, `[1,]` is the same as `[1]`. If you coerce it to number, you get 1. (You get "1" if you toString it.)
In IE8, `[1,]` is the same as creating an array with a length of 2 whose first slot contains 1 and whose second slot was left empty. It's kinda like `[1, undefined]`, but there is no "1" key. If you coerce it to number, you get NaN. (You get "1," if you toString it.)
If you coerce 1 to boolean and negate it, you get false.
If you coerce NaN to boolean and negate it, you get true.
So, basically, it just checks if trailing commas in array literals are handled incorrectly.
comment 11y ago · link · parent
You can use tables, fenced code blocks (there is syntax highlighting too), and images (I use viewBox'd SVGs for my diagrams). And of course there is the usual split view and a live preview on whichever side you prefer. You can also customize the CSS if you want, but the default one looks fine, really.
It does everything I need from a Markdown editor out of the box.
https://code.visualstudio.com/Docs/languages/markdown
(The right sidebar can be toggled with Ctrl+B.)
comment 11y ago · link · parent
By the way, new features are generally created this way. They are added to browsers way before they are standardized. You see, convincing the other browser vendors isn't easy. You need very compelling arguments.
Take WebP, for example. It provides massive benefits. Especially if you can use lossy RGBA instead of PNG32 (easily 80% smaller). And yet, Mozilla shows little interest in implementing it.
comment 11y ago · link · parent
I also bought Deadlight.
I think there is a fairly huge market for platformers. However, it's certainly a very crowded one. There are over 500 platformers on Steam. Want to make one with pixel graphics? There are already 97 of those.
comment 11y ago · link · parent
It uses things like classes, decorators, and the <template> tag. It uses a virtual DOM, which is still a fairly new concept. It can run in Web Workers and you can even use it for native applications which do not have a regular DOM.
It really is quite different from anything one could have started back in 2009. Even those odd-looking attribute might have not worked because HTML5, which specified a lot of those things more precisely, was far from being done.
Angular 1.x made pretty good use of the things which were available at the time.