Skip to content

Instantly share code, notes, and snippets.

View ariela's full-sized avatar

Takeshi Kawamoto ariela

View GitHub Profile
@ariela
ariela / curry.php
Created April 23, 2014 08:59
PHPでカリー化の実験
<?php
/**
* 指定値を最大値として、入力された値が最大値以上の場合は
* 最大値として扱うカリー化関数
* @param integer $max 最大値
* @return Closure 比較関数 f(x)
*/
function compare($max) {
return function ($x) use ($max) {
return ($x < $max) ? $x : $max;
@ariela
ariela / curry.java
Created April 24, 2014 01:43
Java8でカリー化の実験
package curry;
import java.util.function.Function;
interface F<T, R> extends Function<T, R> {}
public class Curry {
public static void main(String[] args) {
F<Integer, F<Integer, Integer>> compare = max -> x -> (max <= x) ? max : x;
@ariela
ariela / main.go
Created July 30, 2014 05:14
画像から彩度の標準偏差を取得し、閾値より大きい場合にカラー画像とする。opencvとcgoで処理。
package main
//#cgo pkg-config: opencv
//#include <cv.h>
//#include <highgui.h>
import "C"
import (
"os"
"flag"
@ariela
ariela / gist:982413
Created May 20, 2011 05:36
AsakusaSatelliteをPassengerで動かしてみる。
$ cd /vaw/www
$ git clone git://github.com/codefirst/AsakusaSatellite.git
$ cd AsakusaSatellite
$ cp config/filter.yml.example config/filter.yml
$ cp config/websocket.yml.example config/websocket.yml
$ cp config/settings.yml.example config/settings.yml
$ vi config/filter.yml
1 - name: auto_link
2 - name: redmine_ticket_link
3 roots:
@ariela
ariela / post-receive
Created May 20, 2011 05:03
gitにpushしたwebサイトを自動的に同期させる
#!/bin/sh
wget -q -O - http://APIのURL
@ariela
ariela / gist:1013592
Created June 8, 2011 01:17
画面上部からスライドして表示
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<title>★文書タイトル★</title>
<style>
/**
* スライドして表示される場所
@ariela
ariela / gist:1016613
Last active September 26, 2015 01:27
Chrome Keyconfig設定
{
"name": "Chrome Keyconfig",
"version": "1.13.1",
"normal_actions": {
"Esc": {
"name": "limited mode",
"args": []
},
"j": {
"name": "scroll down",
@ariela
ariela / conf.d\vhost.conf
Created June 10, 2011 07:33
Apache2 VHOST設定
NameVirtualHost *:80
NameVirtualHost *:433
#
# どのドメイン設定にもマッチしない場合
#
<VirtualHost *:80>
Include conf.d/vhost/default.conf
</VirtualHost>
<VirtualHost *:433>
@ariela
ariela / are.html
Created September 22, 2011 06:13
あれ。
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>やるきのないあれ</title>
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
<style>
#loader {
@ariela
ariela / .htaccess
Created April 16, 2012 00:51
Apache用のhtaccessメモ
# ファイルキャッシュ有効期限
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/css "access plus 7 days"
ExpiresByType text/javascript "access plus 7 days"
ExpiresByType application/x-javascript "access plus 7 days"
ExpiresByType image/gif "access plus 7 days"
ExpiresByType image/jpg "access plus 7 days"
ExpiresByType image/jpeg "access plus 7 days"