coderberry

SailsJS - a New Beginning

I have recently become twitterpated with a fairly new node-based web framework called Sails. It offers the same great awesomeness that Rails has been giving me for so many years along with some new and exciting features such as:

  • Super simple JSON API generation with Blueprints
  • Socket.io integration built in
  • Concurrency and speed!

Over the next few months, I will be teaching myself this amazing framework starting at version 0.10.0-rc9. I will be documenting what I learn here and hopefully will provide assistance to others via these posts. This post will serve as a table of contents with links to each tutorial.

Feel free to contact me at any time on #sailsjs (freenode). I am ericberry on there.

Useful Ember Code Examples

Sharing JavaScript via JSBin, JSFiddle, etc. is great but it can be hard to keep track of them. Here is a list of useful Ember code examples.

Description Tags Author Extra
Active LI Component components @mixonic EmberJS NYC Presentation
Truncate Helper helpers @heyjinkim
Reusable D3 charts components, d3 @heyjinkim Blog Post
Donut Charts components, d3 @heyjinkim Blog Post
Number Counter components @heyjinkim
Share Buttons components @cavneb
Mini Stars components @cavneb
Stars components @cavneb
Gravatar components @cavneb
Em.CollectionView Callback views, tips @cavneb StackOverflow
Copy to Clipboard components @cavneb Blog Post
Two Models, One Route routes, tips Martin Muñoz
Toggle Switches views @adman65 Blog Post
Pagination tips @adman65 Blog Post
Flash Messages tips @cavneb Blog Post
Syntax Highlighter components @cavneb
Em.RSVP.Promise tips @ryanflorence
Sortable Tables controllers @adman65 Blog Post
Ember.debugObj debugging, tips @cavneb
Time on Page components @stv_kn
Spin.js components @cavneb
Funny Gauge components @julienknebel Blog Post

Please feel free to contribute by forking this post and submitting a PR. Or in the comments. Whatever’s clever.

Authentication With EmberJS - Part 3

If you have not yet gone through Part 1 and Part 2, I recommend you do. You can check out the code up to this point with the following:

$ git clone https://github.com/cavneb/simple-auth.git simple_auth
$ cd simple_auth
$ git checkout part-2-completed
$ bundle install
$ rake db:migrate; rake db:migrate RAILS_ENV=test
$ rake test

Also, make sure you run ./bin/ember_build.sh in a separate tab.

What’s Left?

So far, we have created an Ember application with a RailsAPI backend and can register, login and logout. There are a few more things that we want to be able to do before we can call it a wrap on this series.

  1. Pass the access token with each request to the backend and require authorization for some data to return.
  2. Force the user to the login page when they try to access a page which requires authentication.
  3. Add validation to our registration form.

Authentication With EmberJS - Part 2

If you have not yet gone through Part 1, I recommend you do. You can check out the code up to this point with the following:

$ git clone https://github.com/cavneb/simple-auth.git simple_auth
$ cd simple_auth
$ git checkout part-1-completed
$ bundle install
$ rake db:migrate; rake db:migrate RAILS_ENV=test
$ rake test

Add Ember using Ember Tools!

I have created Ember applications using a variety of shortcuts (Yeoman, ember-rails) but have found that Ember Tools is by far the best option available. It allows me to skip the Asset Pipeline completely and work directly in my public folder.