Skip to content

Instantly share code, notes, and snippets.

View ReSTARTR's full-sized avatar
:octocat:

Masaki Yoshida ReSTARTR

:octocat:
View GitHub Profile
@ReSTARTR
ReSTARTR / foo_test.go
Last active August 3, 2019 05:47
Conventions in Go's Table Driven Tests
func TestFoo(t *testing.T) {
tests := []struct {
in string
out string
}{
{in: "foo", out: "FOO"},
}
for _, tt := range tests {
got := Foo(tt.in)
if got != tt.out {
@ReSTARTR
ReSTARTR / README.md
Last active April 6, 2021 10:22
layered architecture in go
@ReSTARTR
ReSTARTR / README.md
Last active February 8, 2021 13:34
zenburn theme for xfce4-terminal

place the file terminalrc into ~/.config/xfce4/terminal/terminalrc.

@ReSTARTR
ReSTARTR / go-http-libraries.md
Last active April 13, 2017 06:05
Go HTTP Libraries

※本記事は2016/09/12 時点の情報をもとに構成しています

GoのWeb開発のためのフレームワークやライブラリについて、整理してみました。

整理するにあたり、いくつかのコンポーネントの分割単位を把握する必要があります。それを単体で提供しているのももあれば、複数の機能をまとめたツールセット(コンポーネント群)、全部入りのフルスタックまで幅広く存在しています。フルスタックなものは各コンポーネントを独自実装している場合が多いです。DBまでカバーしているのはbeegoくらいで、あとは利用者にお任せという仕様。Ruby on Railsのような巨大なものは存在しないと思います。

ライブラリを使わずに標準パッケージのみで構成するのも選択肢として考慮すべきでしょう。選ぶ基準はさまざまだと思いますので、ここではどのあたりが選択基準となるのかを考える材料を提供できればと思います。

評価指標

@ReSTARTR
ReSTARTR / keymap.c
Last active June 10, 2016 16:08
konami command with ergodox
enum {
KONAMI = 1,
};
[BASE] = KEYMAP(
M(KONAMI), // 好きなレイヤーのポジションに設定
);
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
@ReSTARTR
ReSTARTR / README.md
Last active April 26, 2016 15:01
Error handling idioms with pkg/errors
@ReSTARTR
ReSTARTR / write_sock.sh
Last active August 29, 2015 14:20
unix domain socket is not writable with vboxsf
# boot2docker ssh
# cd /Users/yoshida # mounted volume
# Can write text file into the vboxsf volume
docker@boot2docker:/Users/yoshida$ docker run -it --rm -v `pwd`:/tmp ruby:2.0 touch /tmp/foo && ls foo
foo
docker@boot2docker:/Users/yoshida$ rm ./foo
# Cannot write sock file into the vboxsf volume
@ReSTARTR
ReSTARTR / memcache_stats.go
Last active August 29, 2015 14:00
Display the memcached stats
package main
// 写経 from: https://github.com/youtube/vitess/blob/master/go/memcache/memcache.go
// * エラーハンドリングをできるかぎり省略して実装.
// * statsコマンドだけ実装
import (
"bufio"
"flag"
"fmt"
@ReSTARTR
ReSTARTR / README.md
Last active March 6, 2023 23:11
ZeroMQ sample in Go and Python. (with MonitoredQueue)

Versions

  • zeromq: stable 3.2.2
  • go: 1.0.3
    • gozmq: zmq_3_x
  • python: 2.7.3
    • pyzmq: 13.0.2

Usage