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"

2014年4月10日 星期四

2014年4月9日 星期三

CSS - transition:

順序

 transition: transition-property duration-time transition-timing-function delay;

蠻好記的,其實就是p d f delay!

2014年4月7日 星期一

CSS - text rhythm

行距處理的好幫手:http://basehold.it/

用法是將<link rel="stylesheet" href="http://basehold.it/24">

最後面的24改成要的行高,最後將線對齊就完成了。

2014年4月2日 星期三

html Deep dive - form - What' your name?

常見的誤會:

<label for="name">
<input type="text" name="name" >


很容易誤以為label 裡面對應到的name是input element裡的name attribute。
但其實這樣是對應不到的,應該要加上id attribute後,
才能真正對應到,像這個樣子:


<label for="name">
<input type="text" name="name" id= "name">