Skip to content

Instantly share code, notes, and snippets.

View najeira's full-sized avatar

najeira

View GitHub Profile
@najeira
najeira / gist:280c347ecb6bd9f2e680
Created August 15, 2014 03:20
Golang BigQuery example
package main
import (
bigquery "code.google.com/p/google-api-go-client/bigquery/v2"
"code.google.com/p/goauth2/oauth/jwt"
"encoding/json"
"fmt"
)
func main() {
@najeira
najeira / gist:b8c9d438d30b242643bc
Last active August 29, 2015 14:20
Kinesisメモ

GoでKinesis用ライブラリを作るメモ

Writer

Kinesisにデータを送るクラス。

コネクションは呼び出し側で作成してもらう。 それを引数にしてWriterを生成する。

Addメソッドで行を追加していく。

@najeira
najeira / gist:50be958f9ddf966caf28
Created May 11, 2015 02:50
ikのプラグインを作るためのメモ

in_httpを作りたい。

処理の流れを追ってみる。

インスタンス化

AddPluginでファクトリを登録する。 ikはファクトリのNewを呼び出してプラグインを生成する。 このNewでik本体と設定が渡される。

@najeira
najeira / send_goroutine
Last active August 29, 2015 14:24
fluent-logger-golang 修正メモ
## 課題
現在の実装では、送信 `f.conn.Write` の間はロックを獲得しているので、バッファ `pending` への書き込みをブロックする。ネットワークの送信は時間がかかるので、書き込みのパフォーマンスも出ない。
## 対策
Write ではロックを獲得しないようにする。
Write の前に送信するバッファを取得し、書き込み側が違うバッファを使うように差し替える。
また、Write 自体も別のgoroutineで実施する(そうでないと、ロックを回避したのに結局ブロックする)。
@najeira
najeira / libraries.md
Last active January 20, 2016 06:19
Go言語 ライブラリ
#include "ergodox_ez.h"
#include "debug.h"
#include "action_layer.h"
#define BASE 0 // default layer
#define SYMB 1 // symbols
#define MDIA 2 // media keys
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 0: Basic layer
@najeira
najeira / style.md
Last active February 20, 2022 14:57
Flutter/Dart コーディング規約

コーディング規約

インデント

2スペース。

if (hoge) {
  someFunc();
}
@najeira
najeira / locale.dart
Last active May 25, 2018 02:17
Test for Flutter font selection
// A test for https://github.com/flutter/flutter/pull/17879
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
void main() {
runApp(new MaterialApp(
localizationsDelegates: GlobalMaterialLocalizations.delegates,
locale: const Locale("ja", "JP"),
supportedLocales: [
@najeira
najeira / memo.md
Last active September 28, 2018 06:56
Go2 generics

basicaly

contracts が不要な場合の例について。

() は可読性が低い。関数の引数の定義や、呼び出しで使われているため。記号としては、他の言語でも使われている <> を使う。記号が他の箇所と異なり、カッコ内にtypeキーワードがなくても、それがGenericsであることが分かるため、typeキーワードもなくてよい。

func Print<T>(s []T) {
	// ...
}
@najeira
najeira / error.txt
Created October 3, 2018 01:39
Could not build flutter/engine for Android
ninja: Entering directory `out/android_release'
[1/5] LINK clang_x86/gen_snapshot
FAILED: clang_x86/gen_snapshot
../../buildtools/mac-x64/clang/bin/clang++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.12 -m32 -flto -stdlib=libc++ -Wl,-dead_strip -Wl,-search_paths_first -L. -Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/../../.. -Wl,-pie -Xlinker -rpath -Xlinker @executable_path/Frameworks -o clang_x86/gen_snapshot -Wl,-filelist,clang_x86/gen_snapshot.rsp -framework CoreFoundation -framework CoreServices -framework AppKit -framework ApplicationServices -framework Carbon -framework CoreVideo -framework Foundation -framework OpenGL -framework Security -framework IOKit -ldl -lpthread
ld: warning: The i386 architecture is deprecated for macOS (remove from the Xcode build setting: ARCHS)
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Lib