Skip to content

Instantly share code, notes, and snippets.

Hsu Ping Feng fillano

Block or report user

Report or block fillano

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@fillano
fillano / test920.html
Created Mar 5, 2014
getting started example from traceur-compiler
View test920.html
<!DOCTYPE html>
<html>
<body>
<script src="https://traceur-compiler.googlecode.com/git/bin/traceur.js"
type="text/javascript"></script>
<script src="https://traceur-compiler.googlecode.com/git/src/bootstrap.js"
type="text/javascript"></script>
<script>
traceur.options.experimental = true;
</script>
View test922c.js
co(withYield);
withoutYield();
function timeout(sec) {
return function(notify) {
setTimeout(function() {
notify(null, new Date().getTime());
}, sec*1000);
};
}
function co(gen) {
View test922d.js
function * gen() {
console.log('start');
yield "called";
}
var g = gen();
//nothing happened
var a = g.next();
//顯示start
console.log(a.value);
//顯示called
View test922f.js
function * gen(){}
var g = gen();
g.throw('got an error.');
//拋出一個例外,錯誤訊息是 'got an error.'
View test922a.js
function * serial() {
var c = 0;
while(true) {
yield c;
c++;
}
}
var s = serial();
console.log(s.next().value);
//顯示 0
View test922b.js
function * gen() {
var c = 0;
while(true) {
yield c;
c++;
}
}
function run() {
var g = gen();
@fillano
fillano / test.js
Created Aug 7, 2015
just for a reformation of code
View test.js
$(function() {
function split( val ) {
//alert(val);
return val.split( /,\s*/ );
}
function extractLast( term ) {
return split( term ).pop();
}
$("#S1")
@fillano
fillano / ecmascript2015.md
Last active Aug 29, 2015
ECMAScript 2015課程簡介
View ecmascript2015.md

什麼是ECMAScript?

ECMA(European Computer Manufacturers Association)是一個標準組織,他底下有許多委員會,負責制定各種標準。其中一個標準叫做ECMA-262,就是Javascript的標準。這個標準除了定義型別、語法、敘述等程式語言的基本要素,也定義了一套核心的物件。不論在怎樣的平台上執行,Javascript都遵循一樣的語法,也一定內建了這些核心物件。我們所熟悉的Javascript,就是由這些核心的部分,再加上其他函數與物件所組成。在網頁中使用Javascript,除了核心物件,最重要的就是HTML DOM相關物件。如果使用伺服器端的語言例如Node.js,也是由這些核心物件加上執行環境提供的物件所組成。

註:ECMA還制定了其它各種不同的標準,例如C#的標準是ECMA-334,Microsoft Office使用的Office Open XML格式的標準是ECMA-376。對於軟體工程師來說,可能還聽過CLI、Eiffel、JSON、Dart等語言與技術,他們的標準都是由ECMA組成委員會制定的。

ECMAScript的演進

@fillano
fillano / 顯示audio物件資訊
Created Oct 18, 2010
利用audio標籤加上controls屬性來控制,然後檢視相關屬性在播放中的變化。
View 顯示audio物件資訊
<!DOCTYPE html>
<html lang="zh-TW">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
</head>
<body>
<audio src="bwv4_overture.mp3" controls id="player"></audio>
<div id="panel"></div>
</body>
</html>
@fillano
fillano / html5 video tag test
Created Oct 19, 2010
play a m4v or ogg video in different browser and see the status of video object
View html5 video tag test
<!DOCTYPE html>
<html lang="zh-TW">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
</head>
<body>
<video id="player" src="crockonjs-1.m4v" controls poster="vlcsnap-00001.png"></video>
<!--<video id="player" src="Apollo_15_liftoff_from_inside_LM.ogg" controls></video>-->
<div id="panel"></panel>
</body>
You can’t perform that action at this time.