HNHacker News
TopNewBestAskShowJobs

ahoge

1,026 karma · joined December 11, 2011

submissionscomments
ahoge··on An easier way of using polyfills
Firefox 32+ supports it natively.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

http://kangax.github.io/compat-table/es6/

There doesn't seem to be anything wrong with Firefox 32+'s implementation.

ahoge··on An easier way of using polyfills
> How big is the "full" set of polyfills anyway?

Right now it's around 75 kB without minification and without gzip. However, this doesn't include any code for doing feature detection.

So, my somewhat educated guess would be: around 30 kB (which is comparable to jQuery).

ahoge··on Introducing SIMD.js
> What about pixel manipulation of images?

We got this years ago. You can do per-pixel stuff via the Canvas API.

ahoge··on What Is Google Chrome Helper, and Why Is It Hogging My CPU Cycles?
> There is a Google Chrome Helper process for each tab you have open, for each extension you have installed, for each plugin that is currently running and one to talk to the GPU in your system.

You can see the CPU/RAM/network utilization of each in Chrome's task manager. You can open it via Shift + Esc or ☰ -> More Tools -> Task Manager.

ahoge··on AngularJS 1.3.0
It got attention before it was associated with Google. It was created by a googler, but it wasn't a Google project from the beginning.
ahoge··on AngularJS 1.3.0
> Fix the minifiers.

Most minifiers have a switch for that. E.g. UglifyJS2's is "-m"/"--mangle". YUI Compressor's is "--nomunge".

By the way, this stuff looks a lot nicer with AngularDart or Angular 2.x.

ahoge··on SQLite 3.8.7 is 50% faster than 3.7.17
> "premature optimization."

Once a feature works as intended, optimizations aren't premature anymore. You're then in a position where you can profile, measure, and compare.

ahoge··on Whats Wrong with Markdown
Invented? You are missing the point.

The comments are written in a markup language (Markdown, UBB, whatever...) which is then converted to HTML.

It's transformed and not displayed as-is.

ahoge··on Whats Wrong with Markdown
No, they are not. It's not directly spit into an element with white-space: pre-line or white-space: pre.

It's converted into paragraphs. Just like stuff inside asterisks is converted into emphasis.

ahoge··on Whats Wrong with Markdown
Paragraphs and emphasis are frequently used here.
ahoge··on Whats Wrong with Markdown
Reddit, Stack Overflow, GitHub/BitBucket (readmes, tickets, wikis), and it's also used by a couple of CMSs, blog platforms, and static website generators.

Virtually all of the text I write is Markdown. Even this very comment is written in a subset of Markdown (and so is yours).

ahoge··on Whats Wrong with Markdown
> Markdown (.MD) is a text format that lazy people use to write HTML.

Markdown is a markup language for relatively simple structured documents. You can convert it to HTML, but you could as well convert it to something else.

> However that is where the use case ends. .MD is not a useful format for many other cases unless you want to prove to the programmers that you too can do tricky stuff in plain text. For the rest of us it has little value.

It's used by Reddit and some content management systems. Regular users don't have any problems with it. It's a lot easier to use than HTML and also more convenient to use than RTEs.

Markdown isn't for writing HTML. It's for writing the actual content.

I wrote about 100 articles in "raw" HTML. I surely don't miss those days. It was error prone and the tags added very distracting visual noise.

ahoge··on Commander Keen source code released
That's GitHub's CSS. They could set `tab-size` to 4, but they just left it at the default of 8.
ahoge··on Commander Keen source code released
The imperative game logic stuff would be about the same. If this happens, print this and that. If this key is pressed to these 5 things. You can't abstract those steps away.

However, video, audio, input handling, and loading resources would be a lot simpler.

E.g. take a look at the input manager:

https://github.com/keendreams/keen/blob/master/id_in.c

You also wouldn't have anything like this:

https://github.com/keendreams/keen/blob/master/id_ca.c

You'd put some resources in a list and that's all the caching you'd do.

You should be able to do a game like this in less than 10k lines of Dart/TS/JS (2D Canvas, Web Audio, Gamepad API). Without using any external libraries or engines, that is. It also would be a lot easier to write, because all of the low level parts are gone.

ahoge··on JS-SIMD
It's not like SpiderMonkey starts up instantaneously. Also, an interpreter is of course slower than the quick and dirty native code generated by V8.

JSC doesn't seem to have an advantage in the extremely short-running SunSpider benchmark suite.

Dart's snapshots are also something you just can't do with JavaScript, because the program structure is created imperatively with JS. You have to run quite a bit of code before you can actually run the program itself.

> Is it a meaningful amount that I should be worried?

Worried about what? Why would you care anyways? Do you also get worried if some game uses a Lua VM?

I use Dart for pretty much everything. Command line tools, web servers, and client-side scripting. It's an excellent choice for the things I do and the things I want to do.

It's a better fit than Java, C#, JavaScript, Python, or PHP. I still do use those languages occasionally, but Dart is my primary language now.

ahoge··on JS-SIMD
SIMD makes JS a better compile target. The Dart VM is still more "lightweight" (it has to generate a lot less native code) and it offers much faster startup (10x). There also aren't deoptimization traps scattered all over the place. The performance is very predictable.

As far as the VM itself is concerned, it doesn't really matter if other browser start to support Dart natively. The VM is extremely useful for development, you can embed it in native applications, and you can use it to write web servers and other command line tools.

ahoge··on Why CommonMark Isn't the Solution
[Off topic]

  <script>
  var CONTENT = '' +
  "Why Common Markdown isn't the Solution\n" + 
  ...
That's probably the most roundabout way to put an article on the web. You are inlining Markdown in an HTML document. Then the browser has to parse and execute 4.5 MB (!) of JavaScript and then it can finally turn that Markdown string into HTML.

HTML documents are a pretty good choice for, y'know, HTML.

Well, if your goal was to increase the page weight from 10kB to 2.2Mb, you surely succeeded.

ahoge··on Standard Markdown
Reddit and GFM use the same table syntax. Reddit is huge [1]. GFM is widespread.

PHP Markdown, MultiMarkdown, etc also support that syntax. Stack Overflow is pretty much the exception [2].

I'm not interested in Markdown parsers which do not support tables. They are useless to me.

[1] http://www.reddit.com/about/ - "last month, reddit had 114,540,040 unique visitors"

[2] http://meta.stackexchange.com/questions/138946/can-we-add-ma...

ahoge··on Standard Markdown
So are fenced code blocks.
ahoge··on RethinkDB 1.14: binary data, seamless migration, and Python 3 support
I'm really exited about binary data support. The timing is amazingly convenient. It's exactly what I needed right now.

Coming from CouchDB, support for attachments (=binary data) was the only thing I was missing.

ahoge··on DocumentDB
> The SQL-esque syntax is optional. The primary interface is HTTP.

Then the introduction needs some work.

"DocumentDB enables complex ad hoc queries using the SQL dialect"

"Azure DocumentDB offers the following key capabilities and benefits: Ad hoc queries with familiar SQL syntax"

The "Query DocumentDB" article also seems to be focused on that SQL dialect.

ahoge··on DocumentDB
CouchDB doesn't support ad hoc queries. CouchDB is all about MapReduce and heavy caching. It's very rigid.
ahoge··on DocumentDB
I'd say RethinkDB does it best. You just chain some regular function calls and pass some lambdas here and there. It looks and feels very natural. Plus, that "data explorer" thing lets you test those queries quickly.

Generating a list of all used tags:

  r.table('posts')('tags').reduce((a, b) => a.setUnion(b))
Grabbing all posts with the 'foo' tag:

  r.table('posts').filter((doc) => doc('tags').contains('foo'))
ahoge··on Using Mozjpeg to Create Efficient JPEGs
Pngout, optipng, deflopt, jpegtran, gifsicle, cwebp, zopfli, and so forth are all command line tools.

I'm not really sure why you think that this stuff is meant for designers. Recompressing images is a frontend optimization. It's something you automate. It's a task for machines, not humans.

ahoge··on Announcing a specification for PHP
For one, a language specification is mandatory if you want to standardize it (ECMA, ISO, JIS, ...).

Secondly, it paves the way for competing implementations. Having more implementations automatically means more performance, because they compete with each other.

And finally, a language specification is also super useful to people who create tools such as IDEs, linters, or compilers/transpilers.

ahoge··on CSS Variables in Firefox 31 – new syntax
Doesn't work.

http://jsfiddle.net/QEJw9/

ahoge··on Firefox 31.0
Yea, same here. :/
ahoge··on Firefox 31.0
Aw, crap. Do you know the CSS offhand?

I already have to use some user CSS because they removed the ability to set the tab min width via `browser.tabs.tabMinWidth`, because that property wasn't "worth it" according to one developer.

Edit: Turns out Classic Theme Restorer has an option for that.

ahoge··on AnimGIFs need a better codec
Some of this is covered by the WebP FAQ:

https://developers.google.com/speed/webp/faq

ahoge··on Microjs: JavaScript Micro-Frameworks and Micro-Libraries
> why is [file size] a factor so important it must be emphasized this much?

Because there is no dead code removal. All of it goes over the wire. Even the stuff you don't use.

If you use a 70kB library, you'll pay 70kB in page weight for it. Even if you only use half of it.

The Closure Compiler can remove unused code if its "advanced mode" is used. However, it requires everything to be annotated and to be written in a particular style. Very few libraries meet these requirements.

Those micro libraries and micro frameworks try to address this issue by doing only one specific thing.

[Personally, I prefer something Dart's built-in dead code removal. I really don't want to think about that stuff. Let me put 30 tween functions into one lib and simply don't ship those functions I'm not using.]

← PreviousPage 6 of 16Next →