Skip to content

Instantly share code, notes, and snippets.

View akiroom's full-sized avatar

Hiroki Akiyama akiroom

View GitHub Profile
template <typename I, typename O, typename Iterator>
inline void transform_image(
const cv::Mat_<I>& input,
cv::Mat_<O> *output,
Iterator iterator) {
if (input.size != output->size) {
DR_LOGE("Dimensions of input and output images must be identical.");
DR_LOGD("Skipping the rest.");
return;
}
@akiroom
akiroom / Dictionary2ModelObject.playground
Created October 1, 2014 01:07
Dictionary型の変数をmapを使ってモデルに変換するコードです。
var users = [[String: String?]]()
users = [
[
"name": "john",
"age": nil
],
[
"name": "smith",
"age": "22"
]
@akiroom
akiroom / icnumber.rb
Created October 10, 2013 16:58
calculate the number of interchanges from wikipedia(ja)
#
# number of interchanges
#
require 'nokogiri'
require 'open-uri'
ic_urls = %w(
http://ja.wikipedia.org/wiki/%E6%97%A5%E6%9C%AC%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%BF%E3%83%BC%E3%83%81%E3%82%A7%E3%83%B3%E3%82%B8%E4%B8%80%E8%A6%A7_%E3%81%82%E8%A1%8C
http://ja.wikipedia.org/wiki/%E6%97%A5%E6%9C%AC%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%BF%E3%83%BC%E3%83%81%E3%82%A7%E3%83%B3%E3%82%B8%E4%B8%80%E8%A6%A7_%E3%81%8B%E8%A1%8C
@akiroom
akiroom / gist:5779118
Created June 14, 2013 02:43
Rails + HAMLの環境で、URL Helperを使いながらjQuery Templateを使う
-# 以下はダミーコードで、動作検証はしていません
%ul#user-list
%script#profile-template(type="text/x-jquery-tmpl")
%li
!= link_to('${user.name}', user_path('---1')).sub('---1', '${user.id}')
:coffee
users = [
@akiroom
akiroom / Makefile
Created February 11, 2013 16:19
情報処理学会の研究報告(Technical Report)をLaTeXでコンパイルするためのMakefileの、BibTeXを利用するバージョンです。
all:
platex -kanji=euc tech-jsample
pbibtex -kanji=euc tech-jsample
platex -kanji=euc tech-jsample
platex -kanji=euc tech-jsample
dvipdfmx -p a4 tech-jsample
open tech-jsample.pdf
clean:
/bin/rm -f *~ *.log *.dvi *.blg *.aux *.out *.bbl tech-jsample.pdf
@akiroom
akiroom / Makefile
Created February 11, 2013 16:15
情報処理学会の研究報告(Technical Report)をLaTeXでコンパイルするためのMakefileの、BibTeXを利用しないバージョンです。
all:
platex -kanji=euc tech-jsample
#pbibtex -kanji=euc tech-jsample
platex -kanji=euc tech-jsample
platex -kanji=euc tech-jsample
dvipdfmx -p a4 tech-jsample
open tech-jsample.pdf
clean:
/bin/rm -f *~ *.log *.dvi *.blg *.aux *.out *.bbl tech-jsample.pdf
@akiroom
akiroom / UIColor+Utilities.h
Last active December 11, 2015 11:28
UIColor extensions
//
// UIColor+Utilities.h
//
// ref:
// https://gist.github.com/1219029
//
#import <UIKit/UIKit.h>
@interface UIColor (Utilities)
@akiroom
akiroom / calendar.cpp
Created October 16, 2012 02:54
2012年プログラミング方法論カレンダーのサンプル
// 2012-10-16 M. Yasumura
#include <iostream>
using namespace std;
// if leap year then return true else return false;
bool leap_year(int y){
if (y % 4 != 0) return false;
else if (y % 100 != 0) return true;
else if (y % 400 != 0) return false;
else return true;
@akiroom
akiroom / create-new-rails-app.sh
Created September 17, 2012 13:14
Rails3+(haml, less, coffeescript)のアプリケーションを新規作成するためのシェルスクリプト
#! /bin/bash
# カレントディレクトに引数で指定したアプリケーション名のディレクトリをつくって、
# Rails3のアプリケーションにします。オレオレテンプレなので使わない方がいいかも
if [ $# -ne 1 ]; then
echo "指定された引数は$#個です。" 1>&2
echo "実行するには1個の引数(アプリケーション名)が必要です。" 1>&2
exit 1
fi
@akiroom
akiroom / totsuzen.rb
Created June 19, 2012 07:26
突然の死ジェネレータ
# coding: utf-8
# 突然の死ジェネレータ
# $ ruby totsuzen.rb 突然の死
#
str = ARGV.join("\s")
len = str.length / 3 + 1
s = "_" << "人" * len << "_\n> " << str << " <\n ̄" << "Y" * len << " ̄\n"
puts s