2014年4月21日 星期一

Rails - Deploying to Heroku : Why stylesheets can't work?

I found it on stackflow.

This may be the solution, add config.serve_static_assets = true to

config/environment/production.rb

 and run rake assets:precompile

You guess what? Everything is on rails!

Rails - Test fail ! Why?

I make that mistake many times,

 maybe just because of the database doesn't prepared to be tested.

Try 

rake db:test:prepare

AngularJS - Learning resource

http://www.thinkster.io/angularjs/GtaQ0oMGIl/a-better-way-to-learn-angularjs

2014年4月13日 星期日

jQuery - example - Checking Value

Html :





    






JavaScript here



function isValidEmail (email) {
  return email.indexOf('@') != -1;
};
$required = $('.required');
function requiredValues () {
  var inputs = new Array();
  $required.each(function(){
    inputs.push($(this).val());
  });
  return inputs;
  
};



2014年4月12日 星期六

JavaScript - NaN

NaN is a special type of "Number" which actually stands for "Not a Number".

What's special is it doesn't equal to itself,

shall using the isNaN method to detect it.

2014年4月11日 星期五

JavaScript - Hoisting

While initial variable during the middle of function,

Javascript initial a null varible for us at the top of the function whether it's assigned or not.

Example:

function bakery( ) {
    if(false) {
    var cake = "butter" ;
    }
  }
What it will actually do is:

function bakery() {
  var cake;
  if(false) {
    var cake = "butter" ;
    }
  }
That's what we call hoisting.

JavaScript - Scope

depends on function.



funciton(okgo) {
  var color = "Red";
  if (okgo) {
   var color = "Black";
  }
  console.log(color);
}
Result:
  okgo = true;
  "Black"