Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Tuesday, April 15, 2014

Spray + Bootstrap

https://bitbucket.org/diversit/spray-twirl-bootstrap
https://github.com/spray/spray-template

"Spray - Twirl - Twitter Bootstrap" Template Project

This project is based on the Spray Template project. I added support for serving static files, added Twitter Bootstrap files and added Twirl for templating. You can use this project as a template for a REST API or even serve a website.
Spray routing is split up in serveral traits for static routing, twirl pages and inline html.
This project uses Git Flow.
Follow these steps to get started:
  1. Git-clone this repository.
    $ git clone git@bitbucket.org:diversit/spray-twirl-bootstrap.git my-project
    
  2. Change directory into your clone:
    $ cd my-project
    
  3. Launch SBT:
    $ sbt
    
  4. Compile everything and run all tests:
    > test
    
    Note: For the Selenium Chome test to be able to run, you need to install thechromedriver locally. Read my blogpost about how Selenium is setup for ScalaTest. And read the ScalaTest Selenium documentation for using Selenium in ScalaTests.
  5. Start the application:
    > re-start
    
  6. Browse to http://localhost:8080/
  7. Start the application:
    > re-stop
    
  8. Start hacking on src/main/scala/com/example/MyService.scala



Spray Project
This projects provides a starting point for your own spray-routing endeavors. There are 8 branches, providing templates for spray-routing on
  • spray-can, Scala 2.9 + Akka 2.0 + spray 1.0 (the on_spray-can_1.0 branch)
  • spray-can, Scala 2.10 + Akka 2.1 + spray 1.1 (the on_spray-can_1.1 branch)
  • spray-can, Scala 2.10 + Akka 2.2 + spray 1.2 (the on_spray-can_1.2 branch)
  • spray-can, Scala 2.10 + Akka 2.3 + spray 1.3 (the on_spray-can_1.3 branch)
  • Jetty, Scala 2.9 + Akka 2.0 + spray 1.0 (the on_jetty_1.0 branch)
  • Jetty, Scala 2.10 + Akka 2.1 + spray 1.1 (the on_jetty_1.1 branch)
  • Jetty, Scala 2.10 + Akka 2.2 + spray 1.2 (the on_jetty_1.2 branch)
  • Jetty, Scala 2.10 + Akka 2.3 + spray 1.3 (the on_jetty_1.3 branch)
You are currently on the on_spray-can_1.1 branch.
> git clone git://github.com/spray/spray-template.git my-project -b on_spray-can_1.3

Sunday, January 1, 2012

CoffeeScript vs Google Dart



Learn Javascript



  • The best way to learn (and debug) Coffeescript

  • Dart is similar enough to JS but far less common. You will come across more JS than Dart.

  • To understand why CoffeeScript exists, and how Dart differs.

Use Coffeescript



  • CoffeeScript is out there in projects already, so there's community and experience.

  • CoffeeScript might come up at work sooner than Dart (esp. with Rails).

  • CoffeeScript is nice!

Check out Dart


If you understand Javascript, and use CoffeeScript, and have checked out Dart, you'll be in a good position to judge which hammer is best for the task. Most JS/CS knowledge should be transferrable to Dart, the other way around would be more difficult.




[But why the JavaScript generated by Dart is so HUGE ???] - Use Frog compiler instead of DartC to compile/generate smaller JavaScript.



While Dart is pretty neat and backed by Google, it has not be absorbed into the web-applications development community like coffeescript has (coffeescript is the suggested front-end development language of the Rails core team and the preferred front-end language of the ruby community). Coffeescript also has wider support tools and, in my personal opinion, more readability. However, if that does not have you convinced then you can take a look at this ‘Hello World’ program written in Coffeescript and compiled to Javascript then Dart compiled to Javascript (taken from this gist).


Long story short, Dart supposedly offers enhanced security in your front-end (hence all the added junk?) and is more catered to large-scale projects but I won’t be reaching for Dart in the near future. The language syntax is cool and liken to Java but all the useless generated code really makes it hard for me to understand what is going on under the hood. Why use 17K lines of code when 11 will do?


http://blog.brandonmathis.me/blog/2011/10/11/dart-or-coffee/

Google Dart vs Javascript

The fundamental problem with HTML5 is JavaScript, which is not an ideal language for enterprise application development.

Google recognises this issue. An internal email from Nov 2010 that outlines their strategy for ‘Dart’, says:

“Complex web apps–the kind that Google specializes in–are struggling against the platform and working with a language that cannot be tooled and has inherent performance problems”

In the past Google has used Java to JavaScript compilation (GWT) and annotated-JavaScript to JavaScript compilation (Closure) to overcome these problems. In my previous blogpost I speculated that Microsoft could use a similar approach, offering a C# / VB.NET to JavaScript compiler, allowing HTML5 developers to use the full power of Visual Studio. However, with Dart Google are looking to go one step further:

“The goal of the Dash effort is ultimately to replace JavaScript as the lingua franca of web development on the open web platform.”

That’s quite an ambituous goal!


http://www.scottlogic.co.uk/blog/colin/2011/09/dart-will-google-make-html5-applications-viable/

http://www.dartlang.org/