HNHacker News
TopNewBestAskShowJobs

jarek-foksa

1,958 karma · joined April 19, 2011

I'm the developer of boxy-svg.com and xel-toolkit.org.
submissionscomments
jarek-foksa··on EcmaScript Sixth Edition
In ES6 "typeof null" will give you "null" rather than "object". There were also some talks on making "__proto__" non-mutable, but I'm not sure whether this breaking change made it into the spec.
jarek-foksa··on JavaScript as an alternative to AppleScript on OS X Yosemite
Not sure why people would still want to use JavaScript to interoperate with Cocoa interfaces, Swift is easy enough to be used as a scripting language and it was designed to work nicely with Cocoa.

To me it makes more sense to either go completely native with Swift and Cocoa / Cocoa Touch or use hybrid model where HTML 5 content is embedded with the new WKWebView API (aka WebKit 2).

WebKit 2 framework will become public in iOS 8 and OS X 10.10 which means hybrid HTML5/Native apps will be able to run with full speed thanks to JIT, split process model and other optimisations.

jarek-foksa··on The Birth and Death of JavaScript [video]
The sound ʤ seems to occur in most Slavic languages [1], I guess the primary reason why "Java" is read as "Yava" is because people tend to apply local pronunciation rules to commonly used foreign words, either because of lack of knowledge of native pronunciation or because native pronunciation sounds just silly.

[1] http://en.wikipedia.org/wiki/Voiced_palato-alveolar_affricat...

jarek-foksa··on CSS Vocabulary
Canvas is just a low level API for 2D graphics, on top of it you could build your own rendering engine with custom document object model, document serialization format, layout engine, styling engine, etc. This would be an enormous amount of work though, I don't believe that standard HTML/SVG/CSS/DOM are that broken that reimplementing them from scratch would become a viable option.
jarek-foksa··on Propose HN: Screenshot Saturday
http://i.imgur.com/zq2zVI1.png

http://i.imgur.com/0xWZm8z.png

I'm working on a vector graphics editor simillar to Expression Design and Inkscape. The project is written primarly in ECMAScript 6 (via Traceur) and will be shipped on Chrome Web Store, Mac App Store and Play Store later this year.

jarek-foksa··on Widespread sex differences in gene expression in the human brain (2013)
There could be great variance in intelligence, physical strength and aggressiveness between different races of the same species. For example Chihuahua, Doberman and Gray Wolf are races of the same species (Canis Lupus).

Of course humans were not a subject to strictly controlled selective breading like dogs, which means we have much fewer and less diverse races. Still, this is not something that should be completely ignored when trying to understand human behavior, both social and genetic traits matter.

jarek-foksa··on A Reintroduction to JavaScript
As of ES6 I would limit myself to only three styles of writing array for-loops:

1. Crockford's C style with cached array length (fast and flexible, but verbose):

  for (let index = 0, length = array.length; index < length; index += 1) {
    console.log(index, array[index]);
  }
2. Functional style (terse and flexible, but slow):

  array.forEach((value, index) => console.log(index, value));
3. Python style (fast and terse, but not flexible):

  for (let value of array) {
    console.log(value);
  }
By "flexible" I mean being able to e.g. iterate over items with odd indexes or in reverse direction.
jarek-foksa··on Patterns For Large-Scale JavaScript Application Architecture
The article doesn't cover MVC itself, but there are several links to MVC resources (most notably the "Essential JavaScript Design Patterns" book) and the author of the blog is a well known advocate of the "MVC everywhere" approach.

The article references a talk by Zakas who says that all modules should be completely decoupled and communication should be done via a global messaging bus ("the sandbox"). In most cases this approach is an overkill, it will lead to awkward situations where module fires events telling the mediator what should happen rather than what has happened.

I agree there should be as little coupling between modules as possible, but if there is some coupling needed, it should be explicit and clearly stated with direct function calls rather than hidden behind the mediator.

The "module with facade" pattern might make sense in code generated by a compiler, but I would never use this ugly hack in code that is going to be read by other developers. Instead of trying to hide stuff by misusing the return statement and closures I would just use underscore notation.

jarek-foksa··on Patterns For Large-Scale JavaScript Application Architecture
If you follow those patterns you might end up rewritting most of the code when ECMAScript 6 and Web Components will be ready. The standard way of writing reusable code units in ES6 are classes and modules which look nothing like the module pattern described in the article (I wouldn't even call this hack a module). The standard way of handling events in DOM and other browser APIs is observer pattern (i.e. addEventListener), not mediator pattern.

MVC frameworks are overhyped, you don't need them to write maintainable large projects. Check e.g. WebKit Inspector [1] or Gnome Shell [2] source code, those are great examples of how large JS application should be written.

[1] https://github.com/WebKit/webkit/tree/master/Source/WebInspe...

[2] https://git.gnome.org/browse/gnome-shell/tree/js/ui

jarek-foksa··on Steps You Can Take Right Now Against Internet Surveillance
> use EFF's HTTPS Everywhere browser addon for Chrome

Chrome meets all criteria to be classified as malware software, just because a big name company is behind it doesn't make it any less malicious.

jarek-foksa··on The Workman Keyboard Layout
If you are going to learn Workman layout, check my app Type Fu: http://type-fu.com. It has full support for Dvorak and Colemak layouts as well.
jarek-foksa··on Introducing the Qt WebEngine
You could try compiling MiniBrowser which is bundled with WebKit-GTK tarball.
jarek-foksa··on A new breed of Chrome Apps
Definitely, Flash is on the list of web features that are disabled in packaged apps: http://developer.chrome.com/apps/app_deprecated.html
jarek-foksa··on A new breed of Chrome Apps
From my read of the code it appears to be written mostly in JavaScript. There is one NaCl module, not sure what it does though.
jarek-foksa··on Chrome 28 arrives with Blink, rich notifications for apps
If you use Chrome 28 then packaged apps are still not listed or searchable on Chrome Web Store. I don't think there were many changes since Chrome 27 in this field (especially on Linux).
jarek-foksa··on A List of Programming Screencast Series
For C (and Objective-C) I would highly recommend Apple Programming channel: http://www.youtube.com/user/AppleProgramming
jarek-foksa··on PNG vs SVG for sprites
SVG 1.1 spec defines suspendRedraw() and unsuspendRedraw() methods which seem to have somehow similar purpose, though those can be applied only on <svg> elements, are supported only by Firefox and are going to be deprecated in SVG 2.0.
jarek-foksa··on Apple Updates Safari
In terms of the supported Web Platform APIs, is this new Safari release any different from the recent WebKit snapshots? (http://nightly.webkit.org/builds/trunk/mac/1)

Also, is WebKit2 framework still private on OSX 10.9?

jarek-foksa··on Ask HN: What is "expert" level Javascript?
I would expect an expert to know the correct answers to most questions in kangax's quiz: http://perfectionkills.com/javascript-quiz/
jarek-foksa··on Drupal.org compromised

  - Do not use passwords that are simple words or phrases
  - Use different types of characters in your password (uppercase
    letters, lowercase letters, numbers, and symbols).
http://xkcd.com/936/
jarek-foksa··on Native equivalents of jQuery functions
[].filter.call() creates unnecessary Array instance, you should be using Array.prototype.filter.call() instead. Still, such code breaks encapsulation and is plain ugly. It would make much more sense if document.getElementsByTagName() was returning Array instance or if NodeList was inheriting from Array.
jarek-foksa··on Functional Programming in 5 Minutes
In FP functions shouldn't mutate data structures that were passed by reference on input, instead any input data should be copied before performing mutations on it to avoid changes to external state.

This is how e.g. Array.prototype.filter() works in JavaScript:

  var numbers = [1,2,3,4,5,6,7,8,9,10];

  var evenNumbers = numbers.filter( function(number) {
    return number % 2 === 0;
  });
jarek-foksa··on Adobe is going to kill Fireworks
I fail to see how keeping Fireworks around would help SVG. Does Fireworks even support SVG? Isn't it using layered PNG as native format?

Both Expression Design and Fireworks are now out of the way, so Inkscape could get a lot more traction.

jarek-foksa··on Adobe is going to kill Fireworks
Is it using WebKit for rendering?
jarek-foksa··on JS Objects: Inherited a Mess
There was really little evolution of the language since 1995. It was initially launched as a "perfect complement to Java" [1] and until recently its development was stalled.

Constructors and "new" were there from the beginning. Nobody have even noticed the prototypal nature of JS until people like Crockford started evangelising it 10 years later, which in turn resulted in the addition of Object.create() in ES5.

[1] http://www2.ldc.lu.se/temadag95/javascript.txt

jarek-foksa··on JS Objects: Inherited a Mess
JavaScript was a pseudo-classical language from the beginning. JS constructors were and still are the core language feature that clearly tries to mimic classes from Java. I agree that's it's awful, but it can't be depracated or removed from the language because there is so much code relying on it.

Evolving JS into language with minimal dynamic classes such as Python or Ruby should be easy as all interfaces are already "classical", you just need to add some syntactic sugar. This approach was already proved to work by CoffeeScript and TypeScript. I can't imagine how JS could be evolved into clean prototypal language such Io without breaking backwards compatibility.

There is no hope for JavaScript to become elegant prototypal language because of the design mistakes that were done in the past. All that TC39 / ECMAScript.next committee can do is put even more lipstick on a pig.

http://this-plt-life.tumblr.com/post/36425234595/when-somebo...

http://this-plt-life.tumblr.com/post/41438931672/when-somebo...

jarek-foksa··on Comcast injecting JS
Their jQuery code would probably look like http://enterprise-js.com/23, with aggressive caching methods used on all jQuery selectors: http://enterprise-js.com/27
jarek-foksa··on Jakob Nielsen's site has been redesigned
Also, the links are clearly breaking WCAG AA: http://webaim.org/blog/wcag-2-0-and-link-colors/
jarek-foksa··on The "Unknown or expired link" chestnut. Why can't "More" link to ..page=2?
There is no excuse for having broken pagination, table-based layout and GIF images on a modern site, especially when you are targeting tech users. Those are obvious bugs, not features, that should be fixed right away even if it means introducing more code complexity and some refactoring.
jarek-foksa··on Native wrapper for webapps on OSX?
I would stay away from frameworks that expose native APIs to JavaScript. Always use the best tool to do the job. Features such as dock integration, window management, main menu or filesystem access can be implemented in Obj-C/Cocoa with ~500 lines of code.
← PreviousPage 6 of 11Next →