First Ember_rails Project

Last time i said i want to make an ember-rails project(post). Today I push my first Ember-Rails(food-ntpc) project to github and heroku. It takes me more time to finish it because i am not familiar with coffee script. I also create a new post for coffee script memo. During practicing i use Emberjs 1.0.0.rc7. But Emberjs 1.0.0 was released few days ago and i upgrade it to 1.0.0.

Multiple Models in a View

How to use multiple models in a view? Retrieve another data and set to controller in Route’s setupController method.

1
2
3
4
5
6
7
8
9
10
model: ->
  return Place.places()

setupController: (controller, model) ->
  #model is the result of Place.places()
  controller.set 'content', model

  #another data
  categorys = Category.categorys()
  controller.set 'categorys', categorys

I create CategoryView and bind data to it in template

{{#each category in categorys}}
  {{#view CategoryView contentBinding="category"}}
    {{category.name}}
  {{/view}}
{{/each}}

{{#each place in content}}
  {{place.name}}
{{/each}}

CategoryView code: I use classNameBinding to auto update class when status is changed.

1
2
3
4
5
6
7
8
9
10
CategoryView = Ember.View.extend
  classNameBindings: ['getClass']
  status: true

  getClass: ( ->
    if this.get('status')
      return "btn-info"
    else
      return "btn-default"
  ).property('status')

Coffee Script Memo

From last week i tried the Ember-Rails and studied the coffee script btw. Because more and more people use coffee script and i want to understand their codes! In the beginning the coffee script syntax confuses me a lot and cost a lot of time to google it. I decide to keep it on post for reference in the future.

Continue reading →

Rails and Ember Study

I pushed two project(rails101-groupme,project101)to github yesterday. I bought the ebook rails101 and make rails101-groupme project by follow instructions of book. Besides i add some features into rails101-groupme.
1.Every user could reply the post
2.Rich text editor, CKeditor

project101 is the old project i practiced emberjs. It retrieves data from open data Taipei and show on table. This project was made because inspired by yunglinho’s post. I study google map API and add into it recently. Most of locations could be show on google map. Somes are not because can’t be geocode to LatLng. There’s a disadvantage here. Geocode needs to send requests to google but google will block it if you use API frequently. Implement it on clide side is not a good idea. I am planing to have a new project that use Rails and Emberjs. I could add my json API and store LatLng in database to prevent too many requests to google.

Improve Sublime

I install new Color Schemes,Theme,package to sublime and make it’s look and feel better. Here is the list i have added.

1.indent Guide

Make your current indent with different color. Open Preferences > Settings - Default and add draw_active to indent_guide_options

1
2
3
...
"indent_guide_options": ["draw_normal","draw_active"],
...

You could change the color of draw_active. Open your current color scheme setting file. Add

1
2
3
4
5
6
7
8
9
<dict>
  <key>settings</key>
  <dict>
    ...
    ...
    <key>activeGuide</key>
    <string>#CED418</string>
  </dict>
</dict>
Continue reading →

Rails on Heroku

I pushed bookmarks-rails project to Heroku yesterday. Thanks to tutorial i don’t have too many troblem during upload to Heroku. Some parts of doc are out of dated and here i write down the steps for reference myself in the future.

Continue reading →

Rails Practice

I push my first rails project bookmarks-rails to github today. It’s a very small project for practicing rails framework. The web provide user a very simple interface to create a bookmark and basic authentication. I take free time after work to finish this project. Thanks to ihower’s Ruby on Rails實戰聖經,Yangtheman’s post and Code school, it helps me a lot.
I try skills in this projects
1. Twitter Bootstrap 3.0.0.rc1
2. devise account system
3. omniauth with facebook login
4. rails REST
5. RSpec
6. Capybara

Memcached Study

I studied the memcached since yesterday. It’s a good cache implementation used by Twitter,Facebook..etc. Because the official site doesn’t provide the rpm for download and i can’t get the latest version from yum. I learn how to build it from source and also try the repached(for memcached replication but not official)

Continue reading →

Write English Blog

I receive a email from a stranger today. He writes English email to me and ask an emberjs question. He saw my old post but can’t understand what i said because the post was writen by Chinese. I reply the email and he gets the answer finally. Although my blog is put on Internet but I never thought someone will get help from here :) After this I decide to write the post in English from now.

Octopress 設定問題

這兩天使用octopress時遇到了一些問題,有簡單google解決也有亂試之下解決

  • 想產生新的文章時出現
1
You have already activated rake 10.1.0, but your Gemfile requires rake 0.9.6. Using bundle exec
Continue reading →