Skip to content

Instantly share code, notes, and snippets.

;; -*- Mode: Lisp; Syntax: Common-Lisp -*-
;;
;; 第1回 Scheme コードバトン (CL fork)
;;
;; ■ これは何か?
;; 「Scheme のコードをバトンのように回していき面白い物ができあがるのを楽しむ遊びです。」のCL版です。
;; 次回 Shibuya.lisp で成果を発表します。
;; Scheme 初心者のコードを書くきっかけに、中級者には他人のコードを読む機会になればと思います。
;;
;; ■ 2 つのルール
@smeghead
smeghead / groonga filter test
Created March 11, 2011 02:14
checking groonga filter.
% groonga -n tutorial.db
> status
[[0,1299809390.33857,0.000201772],{"alloc_count":141,"starttime":1299809383,"uptime":7,"version":"1.0.8","n_queries":0,"cache_hit_rate":0.0,"command_version":1,"default_command_version":1,"max_command_version":2}]
> table_create --name Site --flags TABLE_HASH_KEY --key_type ShortText
[[0,1299809412.44953,0.035176607],true]
> column_create --table Site --name title --flags COLUMN_SCALAR --type ShortText
[[0,1299809426.68955,0.03979605],true]
> table_create --name Terms --flags TABLE_PAT_KEY|KEY_NORMALIZE --key_type ShortText --default_tokenizer TokenBigram
[[0,1299809437.91029,0.026471031],true]
> column_create --table Terms --name blog_title --flags COLUMN_INDEX|WITH_POSITION --type Site --source title
@smeghead
smeghead / AnyEvent::Groongaのfilter patch
Created March 11, 2011 12:55
AnyEvent::Groongaのfilter指定対応
--- Groonga.pm.org 2011-03-11 20:15:01.338191132 +0800
+++ Groonga.pm 2011-03-11 20:25:53.498125146 +0800
@@ -221,7 +221,7 @@
if ( $command eq 'load' && $key eq 'values' ) {
$value = $self->_load_filter($value);
}
- elsif ( $command eq 'select' && $key eq 'query' ) {
+ elsif ( $command eq 'select' && ($key eq 'query' || $key eq 'filter')) {
$value = $self->_select_filter($value);
}
@smeghead
smeghead / pukiwikiの新規ページ作成でデフォルト値を設定するpatch
Created March 21, 2011 06:10
pukiwikiの新規ページ作成でデフォルト値を設定するpatch。pluginディレクトリで適応すればいい。
--- newpage.inc.php.org 2011-03-21 15:07:44.000000000 +0900
+++ newpage.inc.php 2011-03-21 15:06:35.000000000 +0900
@@ -13,6 +13,10 @@
$newpage = '';
if (func_num_args()) list($newpage) = func_get_args();
if (! preg_match('/^' . $BracketName . '$/', $newpage)) $newpage = '';
+ #set new page default.
+ if (!$newpage) {
+ $newpage = $_GET['refer'] . '/';
+ }
@smeghead
smeghead / CodeIgniter1.7.3_enable_QUERY_STRING.diff
Created March 30, 2011 14:03
CodeIgniter1.7.3 will enable to use QUERY_STRING.
--- system/libraries/URI.php.org 2011-03-30 21:36:00.730915376 +0800
+++ system/libraries/URI.php 2011-03-30 21:56:32.270865996 +0800
@@ -228,7 +228,9 @@
*/
function _explode_segments()
{
- foreach(explode("/", preg_replace("|/*(.+?)/*$|", "\\1", $this->uri_string)) as $val)
+ //befor parse segments, omit query_string.
+ $uri_string = preg_replace("/\?.*/", '', $this->uri_string);
+ foreach(explode("/", preg_replace("|/*(.+?)/*$|", "\\1", $uri_string)) as $val)
@smeghead
smeghead / fullpath.sh
Created April 4, 2011 12:35
bash function retrieve fullpath.
fullpath() {
echo $(cd $(dirname $1);pwd;cd - >/dev/null)/$(basename $1)
}
@smeghead
smeghead / lua result
Created April 12, 2011 14:30
スコープテスト
% lua scope.lua
1
2
3
@smeghead
smeghead / pluginManager.patch
Created April 22, 2011 12:47
ircに接続するためには、読み込む順番が関係あるらしい
--- plugins/pluginManager.js.org 2011-04-22 20:45:09.691124038 +0800
+++ plugins/pluginManager.js 2011-04-22 20:43:23.690968561 +0800
@@ -39,6 +39,7 @@
{
var files=fs.readdirSync('./plugins/core');
var self=this;
+ files.sort(); //sort filenames to read.
_.each(files,function(file){
if(self.isFile(fs.realpathSync('./plugins/core/'+file)))
{
@smeghead
smeghead / .vimrc
Created April 25, 2011 02:54
display git branch on statusline.
autocmd WinEnter,BufEnter * let b:__gitbranchname = system('cd ' . expand('%:p:h') . ' && git symbolic-ref HEAD 2> /dev/null')
"文字コード改行コードの取得
function! GetStatusEx()
let str = ''
let str = str . '[\n:' . &fileformat . ']'
if has('multi_byte') && &fileencoding != ''
let str = str . '[enc:' . &fileencoding . ']'
else
let str = str . '[enc:default(cp932)]'
@smeghead
smeghead / atnd
Created May 15, 2011 14:43 — forked from fukata/atnd
Attendance memo tool.
#!/bin/bash
###########################################################
#
# Clone repo:
# git clone git://gist.github.com/973208.git attendance
#
# Edit your .bashrc
# export ATND_TOOL=/home/fukata/usr/local/attendance
# export PATH=$PATH:$ATND_TOOL