Skip to content

Instantly share code, notes, and snippets.

gitlab bot を使って
コードレビューを
ラクにする話

自己紹介

  • 名前:高山
  • twitter:@edvakf
  • お仕事:
  • pixivのGrowthに関する開発
open System.Collections.Generic
let limit = 100000
let divisor = 1000000
let memo = new Dictionary<int,int> ()
let rec partitions = fun (n, m) ->
if (n >= limit || m >= limit) then 0
elif (n = 0) then 1
#!/usr/bin/env ruby
# coding: utf-8
require 'set'
module GeoLite2_Country
class IPv4Block < Struct.new(:start_ip,
:mask_length,
:geoname_id)
def self.from_line(line)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<?php
class BloomFilter
{
const BYTE = 8;
private $filter;
private $filter_length;
private $bit_num;
private $hash_num;
# 10.2s user time, 210ms system time, 41.18M rss, 233.52M vsz
# Current date: Tue Sep 23 08:18:18 2014
# Hostname: ip-172-31-16-67
# Files: /var/lib/mysql/ip-172-31-16-67-slow.log
# Overall: 43.92k total, 45 unique, 422.35 QPS, 1.68x concurrency ________
# Time range: 2014-09-23 08:15:33 to 08:17:17
# Attribute total min max avg 95% stddev median
# ============ ======= ======= ======= ======= ======= ======= =======
# Exec time 174s 3us 609ms 4ms 38ms 15ms 84us
@edvakf
edvakf / main.go
Created September 26, 2014 12:20
gob serialize
package main
import (
"bytes"
"database/sql"
"encoding/gob"
"log"
Radix "github.com/fzzy/radix/extra/pool"
)
object ProcessEnumerator {
// wraps a ProcessBuilder with Play's Enumerator
// and executes the process in Future
// so that the process' output can be streamed
def apply(process: ProcessBuilder): Enumerator[String] = {
val in = new PipedInputStream()
val out = new PipedOutputStream(in)
Future(process.#>(out).run())
val reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8))
@edvakf
edvakf / rt-router.php
Last active August 29, 2015 14:18
フレームワークではなくライブラリとして使うPHPのルーター案
<?php
if ($m = RT::get('/works/:id' /*pathパターン*/, [':id:uint' /*pathのパラメータ*/])) {
getWorks($m[':id']);
} else if ($m = RT::get('/works/', ['page:uint:1' /*GETパラメータ。デフォルト1*/, 'type:string:' /*GETパラメータ。デフォルト空文字*/, 'tags:string[]' /*GETパラメータ。配列のみ受け取る。デフォルトは空配列?*/])) {
getWorks($m['page'], $m['type'], $m['tags']);
@edvakf
edvakf / mylist.hs
Created May 18, 2015 11:40
mylist.hs
data MyList a = MyEmpty | MyCons a (MyList a) deriving (Show)
instance Functor MyList where
fmap f MyEmpty = MyEmpty
fmap f (MyCons x xs) = MyCons (f x) (fmap f xs)
instance Applicative MyList where
pure x = MyCons x MyEmpty
MyEmpty <*> _ = MyEmpty
_ <*> MyEmpty = MyEmpty