Posts

Showing posts from July, 2012

Simple Dart + WebSocket demo

[EDIT: Updated on 2013-03-05]

I just posted a simple demo of Dart with WebSockets. Not only does it show how to connect to a WebSocket server and send messages, it also shows off a few neat features of the Dart language.

(The code follows below, or check out the full open source project.)

Look mom, no classes!

Dart is a class-based object oriented language, but that doesn't mean you are required to wrap everything in a class. No sir, this is Dart, not Java. In Dart, you can use top level functions and top level variables.

Libraries for modularity

Dart organizes code into libraries for modularity. For example, this code uses the dart:html library for the WebSocket code. Concerned about bloat here? Don't be! Thanks to tree-shaking, the code that you don't use is eliminated during a (optional) compile step. The Dart to JavaScript compiler uses tree shaking to help generate minimal JavaScript code (still more work to do here). An upcoming Dart to Dart script will also generate a…

How we built the new Dart homepage

Image
I work with the Dart team, and we needed to update our dartlang.org site. It was a fun project to rebuild dartlang.org, so I wanted to give a shout-out to some of the libraries and tools that we used.



Requirements for the new dartlang.org included:

work on multiple screen sizesdisplay more obvious calls to actionload fasterclean up CSSdisplay more info on the home page To achieve these goals, we used the following tools:Bootstrap CSS and widgetsJekyll (and plugins) site generatorMarkdown with kramdown text file formattingPygments syntax highlighterCompass CSS frameworkBootstrap + Compass for SCSSFont Awesome for sprite iconsMake build tooloptipng image shrinkerApp Engine hostingBootstrap, from Twitter, is a slick set of CSS styles and simple JavaScript plugins. Bootstrap has a grid system, pre-defined styles, and most importantly a sane set of defaults for adaptive layouts.
Jekyll is a static site generator. I'm a big fan of static sites, but I didn't want to give up modular tem…