本文譯自 Julio Merino 2018 年七月撰寫的 Rust vs. Go 一文。Julio Merino 是 G 社僱員,在 G 社工作超過 8 年,無論工作內外,都接觸開發不少 Go 語言,並撰寫 [Rust 點評][rust-review]系列文,來聽聽他對 Rust 與 Go 的想法吧。
Thanks Julio Merino for this awesome article!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace App\Traits\Models; | |
| use App\Models\Team; | |
| use Illuminate\Database\Eloquent\Builder; | |
| trait BelongsToTeam | |
| { | |
| // This method is executed when a new model is being created. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Author: Neel Bhanushali <neal.bhanushali@gmail.com> | |
| document.addEventListener('keydown', function(e) { | |
| // add scan property to window if it does not exist | |
| if(!window.hasOwnProperty('scan')) { | |
| window.scan = [] | |
| } | |
| // if key stroke appears after 10 ms, empty scan array | |
| if(window.scan.length > 0 && (e.timeStamp - window.scan.slice(-1)[0].timeStamp) > 10) { | |
| window.scan = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // Please read http://codepodu.com/subdomains-with-golang/ | |
| // It's just copy and paste :smile: | |
| // | |
| // | |
| // URLs : | |
| // http://admin.localhost:8080/admin/pathone | |
| // http://admin.localhost:8080/admin/pathtwo | |
| // http://analytics.localhost:8080/analytics/pathone | |
| // http://analytics.localhost:8080/analytics/pathtwo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| <a href="posts/2" data-method="delete"> <---- We want to send an HTTP DELETE request | |
| - Or, request confirmation in the process - | |
| <a href="posts/2" data-method="delete" data-confirm="Are you sure?"> | |
| Requires you to have a meta tag with CSRF Token: | |
| <meta name="csrf-token" content="{{ csrf_token() }}"> | |
| */ |
Twelve Go Best Practices
Francesc Campoy Flores Gopher at Google @francesc http://campoy.cat/+
- Best practices
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| <a href="posts/2" data-method="delete"> <---- We want to send an HTTP DELETE request | |
| - Or, request confirmation in the process - | |
| <a href="posts/2" data-method="delete" data-confirm="Are you sure?"> | |
| */ | |
| (function() { |