Skip to content

Instantly share code, notes, and snippets.

View serihiro's full-sized avatar

Kazuhiro Serizawa serihiro

View GitHub Profile
@serihiro
serihiro / gist:0da1d5b680ad530d606c
Last active August 29, 2015 14:06
箱根旅行プラン案
@serihiro
serihiro / gist:d548f568e522adefa49c
Created October 15, 2014 11:51
Rails.logger.debug('hoge')のソースがどのように呼ばれてるかをおっかけた

適当にモンキーパッチ当ててRails.logger.debug('hoge')で死ぬようにする

def add(severity, message = nil, progname = nil, &block)
    severity ||= UNKNOWN
    if @logdev.nil? or severity < @level
      return true
    end
 progname ||= @progname
@serihiro
serihiro / gist:2e1e29d5a22cc473497b
Last active August 29, 2015 14:14
メアドとか電話番号とか入れたらダメよ〜ダメダメってやるための正規表現
/[0-90-9a-za-zA-ZA-Z..__ー―]+(@|@|あっと|アット|アット)[0-90-9a-za-zA-ZA-Z__ー―]+(\.|.)[0-90-9a-za-zA-ZA-Z..__ー―]+/
/[\d0-9]{2,4}(-|−|ー|―)[\d0-9]{2,4}(-|−|ー|―)[\d0-9]{4}/
@serihiro
serihiro / td-agent.rb
Last active August 29, 2015 14:15
td-agent-1.1.7-for-maverics-fomula
require 'formula'
class TdAgent < Formula
url 'https://github.com/treasure-data/td-agent.git', :revision => '485aca031ccb6eec526caf9b596021e73f42b786'
head 'https://github.com/treasure-data/td-agent.git'
homepage 'https://github.com/treasure-data/td-agent'
version '1.1.17'
option 'fluentd-rev=<revision>', 'Using specify Fluentd revision'
option 'ruby-ver=<version>', 'Using specify Ruby version listed by ruby-build'
@serihiro
serihiro / gist:00241c0c572c60ee903f
Last active August 29, 2015 14:17
personal note about scala
@serihiro
serihiro / jsonp_sample.php
Created May 30, 2012 09:21
JSONP API SAMPLE
<?php
/*
*
This JSONP API returns jsonp function call to JS script which called this JSONP API.
@response:
{*callback function name*}({[foo: "homhom"] , [bar: "anan"]});
*
@serihiro
serihiro / htmltmp.html
Created June 21, 2012 14:18
HTML5 Template
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="" type="text/css">
<script src=""></script>
<script src=""></script>
<script src=""></script>
<script src=""></script>
@serihiro
serihiro / lotationLog.sh
Created June 30, 2012 16:10
Log lotation script
#! /bin/sh
#
# This script excutes to archive log daily, and
# delete archived file whose timestamp is over day period you setted.
TODAY=`date +%Y-%m-%d`
#Directory you put logs. (ex '/home/app/program/log'
@serihiro
serihiro / GroongaHTTPUtil.php
Created August 15, 2012 01:23
Groonga through HTTP Utility for PHP
<?php
class GroongaUtil{
/*
* This Class is Utility for Groonga with HTTP.
*
* Groonga is an open-source fulltext search engine and column store.
* For detail of Groonga , see following web site.
* http://groonga.org/
*
@serihiro
serihiro / cronko.php
Created August 17, 2012 23:36
cronko.php (for internal)
<?php
include "sitesetting.php";
include "setting.php";
$db = mysqli_connect( $dbHost, $dbUser, $dbPass, $dbName );
if( mysqli_connect_errno() ){
die("データベースとの接続に失敗しました。:" . mysqli_connect_error());
}else{