What is CDN?
Youtube - 詳細介紹
這部影片中有很詳細的介紹,甚麼是CDN以及為時麼要使用CDN。
投影片下載 :
https://docs.google.com/present/view?id=0AWHocwCRARczZGNmZG53ZmZfMTE4OXd3azdkM2Rk&hl=en_US&pli=1
http://mustache.github.com
http://code.jquery.com/jquery-1.7.2.min.js
https://github.com/janl/mustache.js/blob/master/mustache.js
// 範例一
var sample1 = "";
sample1 += 'Hello {{name}}';
sample1 += 'You have just won ${{value}}!';
var data1 = {
name : "Chris",
value : 10000,
}
var result1 = $.mustache(sample1, data1);
console.log(result1);
Hello Chris
You have just won $10000!
// 範例二 ture/false 判斷
var sample2 = "";
sample2 += 'Hello {{name}}';
sample2 += 'You have just won ${{value}}!';
sample2 += '{{#in_ca}}';
sample2 += 'Well, ${{taxed_value}}, after taxes.';
sample2 += '{{/in_ca}}';
var data2 = {
name : "Chris",
value : 10000,
taxed_value : 10000 - (10000 * 0.4),
in_ca : true
}
var result2 = $.mustache(sample2, data2);
console.log(result2);
Hello Chris
You have just won $10000!
Well, $6000.0, after taxes.
// 範例三 啟用/禁止Mustache編碼機制
var sample3 = "";
sample3 += '{{name}}';
sample3 += '{{age}}';
sample3 += '{{company}}';
sample3 += '{{{company}}}';
sample3 += '{{&company}}';
var data3 = {
name : "Chris",
company : "<b>GitHub</b>"
}
var result3 = $.mustache(sample3, data3);
console.log(result3);
* Chris
*
* <b>GitHub</b>
* <b>GitHub</b>
// 範例四 Non-Empty List
var sample4 = "";
sample4 += '{{#repo}}';
sample4 += '{{name}}';
sample4 += '{{/repo}}';
var data4 = {
repo: [
{ name: "resque" },
{ name: "hub" },
{ name: "rip" },
]
}
var result4 = $.mustache(sample4, data4);
console.log(result4);
<b>resque</b>
<b>hub</b>
<b>rip</b>
// 範例五 使用Lambda
// 甚麼是 Lambda? http://stackoverflow.com/questions/16501/what-is-a-lambda-function
var sample5 = "";
sample5 += '{{#wrapped}}';
sample5 += ' {{name}}';
sample5 += '{{/wrapped}}';
var data5 = {
name: "Willy",
wrapped: function() {
return function(text) {
return "" + text + ""
}
}
}
var result5 = $.mustache(sample5, data5);
console.log(result5);
<b>Willy is awesome.</b>
// 範例六 Empty List Catch
var sample6 = "";
sample6 += '{{#repo}}';
sample6 += '{{name}}';
sample6 += '{{/repo}}';
sample6 += '{{^repo}}';
sample6 += 'No repos :(';
sample6 += '{{/repo}}';
var data6 = {
repo: [
]
}
var result6 = $.mustache(sample6, data6);
console.log(result6);
No repos :(
https://www.facebook.com/username
https://www.facebook.com/sitetour/chat.php
https://www.facebook.com/sitetour/chat.php
filter:alpha(opacity=50); /* IE */
-moz-opacity:0.5; /* Moz + FF */
opacity: 0.5; /* 支持CSS3的瀏覽器(FF 1.5也支持)*/
filter:alpha(opacity=50); /* IE */
-moz-opacity:0.5; /* Moz + FF */
opacity: 0.5; /* 支持CSS3的瀏覽器(FF 1.5也支持)*/
filter:alpha(opacity=50); /* IE */
-moz-opacity:0.5; /* Moz + FF */
opacity: 0.5; /* 支持CSS3的瀏覽器(FF 1.5也支持)*/
<!DOCTYPE html>
<html>
<head>
<style>
div { color:blue; }
span { color:red; }
</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<div>
The values stored were
<span></span>
and
<span></span>
</div>
<script>var div = $("div")[0];
jQuery.data(div, "test", { first: 16, last: "pizza!" });
$("span:first").text(jQuery.data(div, "test").first);
$("span:last").text(jQuery.data(div, "test").last);</script>
</body>
</html>
$("div").data("test", { first: 16, last: "pizza!" });
$("div").data("test").first //16;
$("div").data("test").last //pizza!;
// Simple object
var myObject = {myProperty : 'myValue'};
// using jQuery append property
$.data(myObject, 'newProperty1', 'newValue1');
$.data(myObject, 'newProperty2', 'newValue2');