Skip to content

Instantly share code, notes, and snippets.

View shibukawa's full-sized avatar

Yoshiki Shibukawa shibukawa

View GitHub Profile
>>> a = [ 9, 5, 4, 2, 1]
>>> b = [ 2, 4, 7, 8, 10]
>>> def sortset(s, a):
... return sorted(s, key=lambda e: a.index(e))
...
>>> sortset(set(a) - set(b), a + b)
[9, 5, 1]
>>> sortset(set(b) - set(a), a + b)
[7, 8, 10]
https://twitter.com/y_cony/status/1098757985487048704
いいリーダーの共通点
・朝の「おはよう」を先に言う
・忙しそうに見えない
・まずは周りに与える
・話を黙って最後まで聴く
・会議の終了時間を死守する
・叱るときは冷静に、褒めるときは感情的に
@shibukawa
shibukawa / gist:709d6af5caaecb920a98250b0c74bfd0
Created January 8, 2019 11:30
RealWorldHTTPコミットログ
commit 839b0d941e962c9b902804312f301700ba203d98
Author: Yoshiki Shibukawa <>
Date: Fri Jun 30 11:02:26 2017 +0900
追加し忘れていたサンプルを追加
commit f95422007bf5689ccfeefa1812916209b4af6485
Merge: 252df5f 268f8bc
Author: Akihiro Takizawa <>
Date: Fri Jun 16 10:30:13 2017 +0900
@shibukawa
shibukawa / cg.d.ts
Last active October 29, 2018 15:14
interface ICommonColumn<T> {
width?: number | string;
minWidth?: number | string;
maxWidth?: number | string;
caption?: string;
style?: IStyle | styleFunction<T>;
padding?: string | number[];
textOverflow?: "clip" | "ellipsis";
action?: string;
@shibukawa
shibukawa / generics.md
Last active September 29, 2018 16:55
Feedback for generics/contract proposals

Abstract

I don't think this generics/contract proposals have enough advantages. I am against them.

Why Generics is needed

For a long period, many people have wanted generics for the following purposes:

  • Avoid type casting from interface{} (as this proposal mentioned).
  • Improve performance (like C++'s specization feature like this).
@shibukawa
shibukawa / error handling.md
Last active September 28, 2018 02:05
Every handle should have return statement

Basically, error handling code and regular code have different purpose/aspect. So splitting error handling code from regular code is just introducing some type of "goto" structure essentially.

I like handle/check work locally inside function and are resticted not to escape between functions unlike exception are good point. But I think this design proposal may create a very complicated structure。

If there is only one handle per scope ({ }), it is resonable, but there are many handles and/or have defers in same scope, make code difficult. If we have to control error handling finely, error handling code and regular code are mixed like bunch of if err != nil sentences.

My suggestion

FROM node:latest as builder
ADD src src
WORKDIR src
RUN npm install && \
npm run build
FROM node:alpine as runner
COPY src/package.json .
@shibukawa
shibukawa / sample.svg
Last active October 3, 2017 16:39
multiline
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shibukawa
shibukawa / chunked_encoding_01.go
Created June 28, 2017 10:56
tokyo node gakuen #26
package main
import (
"fmt"
"log"
"net/http"
"strings"
"time"
)
package main
import (
"testing"
"math/rand"
)
type Mat32_32 [6]float32
func NewMat32_32() *Mat32_32 {