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
View test002.php
<?php
declare(ticks=20000000);
$a = new handle();
register_tick_function(array(&$a, 'handler'));
while($a->a > 0) {
//sleep(1);
}
class handle {
var $a = 1;
public function handler() {
@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 / 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")
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 test922b.js
function * gen() {
var c = 0;
while(true) {
yield c;
c++;
}
}
function run() {
var g = gen();
View test922a.js
function * serial() {
var c = 0;
while(true) {
yield c;
c++;
}
}
var s = serial();
console.log(s.next().value);
//顯示 0
View test922f.js
function * gen(){}
var g = gen();
g.throw('got an error.');
//拋出一個例外,錯誤訊息是 'got an error.'
View test922e.js
function * gen() {
console.log('start');
var got = yield 'called';
console.log(got);
}
var g = gen();
var a = g.next();
//顯示start
var b = g.next('hello generator');
//顯示hello generator
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
@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>
You can’t perform that action at this time.