Log for
OwO
所以让程序员处理要 let 还是 const 还是 var 啊
所以好的IDE比搞coffee script好多了
transpiler 啊 (话说你还在用 ECMAScript) ?
Node v7.4 都能够 async await 了
而 transpiler 是用函数来处理 var 的局部作用领域
也有可能是 typeof variable === "undefined"
umm...我目前目標是一個人完成一個比較大些的專案...
🌚 后端用 Haskell, 前端使用 Electron-shell, 简单的 JS 渲染界面然后启动 Rust 来处理任何的东西
这里的 Rust 没那么简单,其实是有注册在 Node V8 里面,用 V8 的垃圾回收机制来处理我的 Object
不过也没有什么垃圾好收的,因为我的是一个 Object 一个窗口
而且不容易出错误,从我用 Haskell 和 Rust 就是这样
Electron-shell 的 JS 基本上就是给我用来 bootstrap 整个二进制文件的,而我写得能够有效利用 V8 的 GC
没办法,因为 electron shell 就是内置 node
其實我也有想過用 Servo 替代 Electron
用單一語言幹的後台跟一堆語言幹的後台感覺後者我會很有障礙
我到現在還是很好奇為什麼 Atom 可以這麼卡,因為都用 JS 做處理?
只要选对数据结构,JS 和 Rust 的区别你根本察觉不到
而且优化得很 aggressive, 深度优化你的代码。前提是你选对数据结构
不直接控制内存,但是很抽象的用惰性求值来处理很多东西
所以你要在 Haskell 想啊,持久化的数据结构
🌚🌝 我想要说的是,如果你的数据结构用的不是状态的话,通常都没有性能问题的
在最顶端放我的 history id 就能够做历史回顾了
这就是选对数据结构的重要性,FP 的编译器比命令式的编译期更了解你的代码,然后很大程度地优化,重置你的代码结构
嗯,最顶端的只是存这个树的讯息,其余的就是存指针,还有序号,一直排下去,到最底才是我们要存放的数据
你修改单一节点的数据,就创建一个新的,然后指向之前的,而且不是修改的节点的节点咯
我在思考,如果有個交換層去緩衝然後整理這些資料的話會不會更好
其实,这个数据可以安排一个 32 bit 的空间来存放节点
加上你用的是 int 类型就能够索引 32 个节点
在 Node.js 裡面要用到 AJAX 都會用什麼?Superagent?
現在已經沒人用xml了吧 jquery ajax都已經在用json了吧
以前我是寫一個個js Class去代表可重用的component
什麼MVC都是js Class和JQ加Mustache實現的(
Webpack, Babel, React, Vue.js, Riot
你用 jQ 加 mustache 和 webpack 用也可以
也可以單純只用 Vue.js 然後不要 WebPack
😐 你们都错了,babel 不是让你用什么新奇的东西。
他只是一个 polyfill 让你转换代码成为兼容某个程度的 template
我发现到,其实 Object 直接修改 prototype 操作很吃力
干脆创建一个新的 Object, 新的 prototype 好了
function () {
let callee = this;
callee ....
}有性能提高嘛?
今天回旧家寻找东西,发现了我小学时期傻傻买的两本书
Require 可以這樣
var req = require('package')(dep);
在 Import 裡面有沒有辦法這樣?還是說一定要 Require?
去掉search' icon的margin right就好了
js玩太久,写回php会怕,我刚刚echo $username + " " + $password; 然后调试了5分钟,原来是用 ....
你不會直接 echo "$username $password"
JS 的 Sprintf 要用什麼?npm 的 sprintf?
function _GET($key) {
return isset($_GET[$key]) ? $_GET[$key] : null;
}
$username = _GET("username");
所以你就不用整天
$username = isset($_GET["username"]) ? $_GET["username"] : null;
function _POST($key) {
return isset($_POST[$key]) ? $_PSOT[$key] : null;
}
中國那邊薛錢的 Web game 還一堆 Flash
最近看到 FaceRig 好像都在說 A.I Channel
Fucking Lots Asshole Shit Human(X
🌚 Avatar 出了名用 Linux 集群做动画的啊
<?php
$test['_string'] = "";
$test['_int'] = 0;
$test['_float'] = 0.0;
$test['_null'] = null;
$test['_arr'] = array();
$test['_obj'] = new \stdClass();
foreach($test as $key => $value)
{
echo $key.": ";
if($value == null)
echo "is null\n";
else
echo "is not null\n";
}die();
?>
will give you
_string: is null
_int: is null
_float: is null
_null: is null
_arr: is null
_obj: is not null
還有 Type Hinting
function(int $number)
好像是 isset && !is_null 的簡寫?
除了效能以外其實我看不太出來 Node.js 贏 PHP 哪裏
🤔 安全性在動態語言你不如說沒有 Type hinting 的 JS 更危險點
不過我後來其實發現 PHP 可以自己寫成一個 Server
PHP 也可以像 Node.js 一樣自己 Host 不用 apache
那個,我懂你的意思,你應該是說什麼鳥 CGI,PHP 是依照網址讀取腳本的
@S_ean 認為 @SooXiaoTong 的意思是: MCPE\0server\0php 写的
但是 PHP 也可以透過 Routing 或是自己 Host 來省去這種依照網址讀取 .php 檔案的麻煩
意思就是所有外來請求都會傳遞到 index.php 然後再由 index.php 去做處理,應該呼叫哪些 Class 或是 .php 檔案
回到原點,其實我真的很好奇 Node.js 除了效能以外贏過 PHP 哪裏⋯⋯
應該說nodejs根本沒有muti core的設計php有對吧?
如果php 塞进jit里 == nodejs的速度
PHP 的 async 就直接是開一個新的 Thread 了
不然你就用 Shell 去呼叫另一個 .php 囉
🤔 可是當用了有 async 的語言,就會用到一堆 async
在nodejs可以開childprocess然後跑完之後call結果
异步做到同步,只需要 async/await 保证顺序就行了
而同步的要做到异步,你需要生成器,还有 event looper 来管理线程跳转
我寧願預設就同步,也不要預設異步,然後花一堆時間在管理邏輯上
callback 也是通过续插入参数,保证顺序而已
我跳到 Go 主要是因為從 PHP 換到 Node.js 感覺沒什麼驚喜
那你还是乖乖用 python 或是…… scratch ?
所以你不了解一个东西就在呛,套用你的思路来定义别人
我覺得 Node.js 就是大家一窩蜂衝過去當大型商業用途,
接下來發現要維護太麻煩,結果轉用 TypeScript,後來發現不如跳到其他語言
你也沒辦法藏code阿,隨便找另一個寫nodejs的人
等你寫到後面你就會發現邏輯流要維護,
確認 this,然後 Object 是被 copy 還是指向原本的 object
prototype 什麼鳥的
🌚 这就是你用 CoffeeScript 的原因?
所以你用 CoffeeScript,就是因为你能够呛 CoffeeScript 的作者而不是 ES 委员会咯
反正 CoffeeScript 把你想要的东西编译成肮脏的 JS 代码
🤔 其實他們在 CS2 有把很多東西轉成 ES6 了
就让 CoffeeScript 的开发者来被 ES syntax 婊啊
因為有些 ES6 Syntaxes 都已經普遍支援了?
还有很多奇怪的,破坏兼容的,破坏程序结构的函数都去掉了
ES 坑哪裡少了,不是越挖越多,然後把挖起來的東西拿去補一下以前的東西嗎
Promise 就是用来取代 callback 的
还有保证 callback 能够处理 corner cases
callback => promise (处理错误)
callback => async/await (处理顺序)
看看 PHP 被寫的那麼糟也不是沒理由,因為太寬容
我现在的思路 PHP 》 async 》callback 》C async 》 PHP 》TS 》react TS 》nodejs 》 zend -》ES 》 callback 》 promise 》 C
这个只是语法层面,然而有那么多技巧能够避免 cb 嵌套
你能够 bind, 你能够 promise`,你能够 `async 宣告单一函数
你能够 bind, 你能够 promise`,你能够 `async 宣告单一函数
你能够 bind, 你能够 promise ,你能够 async 宣告单一函数
$this->table->column('test')->varchar(32)->primary()
->create('test_table');
@.@ PHP-MySQLi-Database-Class
$this->hoff->column('test')->tinyint(1)
->column('test2')->smallint(1)
->column('test3')->mediumint(1)
->column('test4')->int(1)
->column('test5')->bigint(1)
->column('test6')->char(1)
->column('test7')->varchar(1)
->column('test8')->binary(1)
->column('test9')->varbinary(1)
->column('test10')->bit(1)
->column('test11')->tinytext()
->column('test12')->text()
->column('test13')->mediumtext()
->column('test14')->longtext()
->column('test15')->tinyblob()
->column('test16')->blob()
->column('test17')->mediumblob()
->column('test18')->longblob()
->column('test19')->date()
->column('test20')->datetime()
->column('test21')->time()
->column('test22')->timestamp()
->column('test23')->year()
->column('test24')->double([2, 1])
->column('test25')->decimal([2, 1])
->column('test26')->float([2, 1])
->column('test27')->float([1])
->column('test28')->enum(['1', '2', '3', 'A', 'B', 'C'])
->column('test29')->set(['1', '2', '3', 'A', 'B', 'C'])
->create('test_table1');
$this->hoff->column('test')->tinyint(1)
->column('test2')->smallint(1)
->column('test3')->mediumint(1)
->column('test4')->int(1)
->column('test5')->bigint(1)
->column('test6')->char(1)
->column('test7')->varchar(1)
->column('test8')->binary(1)
->column('test9')->varbinary(1)
->column('test10')->bit(1)
->column('test11')->tinytext()
->column('test12')->text()
->column('test13')->mediumtext()
->column('test14')->longtext()
->column('test15')->tinyblob()
->column('test16')->blob()
->column('test17')->mediumblob()
->column('test18')->longblob()
->column('test19')->date()
->column('test20')->datetime()
->column('test21')->time()
->column('test22')->timestamp()
->column('test23')->year()
->column('test24')->double([2, 1])
->column('test25')->decimal([2, 1])
->column('test26')->float([2, 1])
->column('test27')->float([1])
->column('test28')->enum(['1', '2', '3', 'A', 'B', 'C'])
->column('test29')->set(['1', '2', '3', 'A', 'B', 'C'])
->create('test_table1');
$this->hoff->column('test')->varchar(32)
->column('test2')->varchar(32)
->primary(['test', 'test2'])
->create('test_table4');
$this->hoff->column('test')->tinyint(1)
->column('test2')->smallint(1)
->column('test3')->mediumint(1)
->column('test4')->int(1)
->column('test5')->bigint(1)
->column('test6')->char(1)
->column('test7')->varchar(1)
->column('test8')->binary(1)
->column('test9')->varbinary(1)
->column('test10')->bit(1)
->column('test11')->tinytext()
->column('test12')->text()
->column('test13')->mediumtext()
->column('test14')->longtext()
->column('test15')->tinyblob()
->column('test16')->blob()
->column('test17')->mediumblob()
->column('test18')->longblob()
->column('test19')->date()
->column('test20')->datetime()
->column('test21')->time()
->column('test22')->timestamp()
->column('test23')->year()
->column('test24')->double([2, 1])
->column('test25')->decimal([2, 1])
->column('test26')->float([2, 1])
->column('test27')->float([1])
->column('test28')->enum(['1', '2', '3', 'A', 'B', 'C'])
->column('test29')->set(['1', '2', '3', 'A', 'B', 'C'])
->create('test_table1');
左邊是 CoffeeScript,右邊是生成的 JavaScript
我比較習慣看右邊的格式,大概是大學以來都學右邊這樣的架構xd
如果說螢幕裡那些code塞滿我或許會比較喜歡coffee script
🤔 ovuvuevuevue enyetuenwuevue ugbemugbem osas