2009-08-01から1ヶ月間の記事一覧

anything-projectの候補にディレクトリが含まれないようにする

(setq ap:project-files-filters (list (lambda (files) (remove-if 'file-directory-p files)))) 最新の anything-project.el だと上のように書いておけばファイルのみが対象になります。

ランダムに一つのROWをとってくる

package App::Schema::Table::Hoge; use strict; use warnings; use base qw/DBIx::Class::ResultSet/; sub get_random_row { my ($self) = @_; my @ids = $self->search( {}, { select => [ qw/ id / ], } )->get_column('id')->all; my $id = $ids[ int( r…

auto-complete.el の ac-source-words-in-buffer の候補に日本語を含む単語が含まれないようにする

(require 'cl) (require 'auto-complete) (defadvice ac-candidate-words-in-buffer (after remove-word-contain-japanese activate) (let ((contain-japanese (lambda (s) (string-match (rx (category japanese)) s)))) (setq ad-return-value (remove-if …

symfony.el始めました。

一昨日くらいからsymfony.elを作り始めました。 rails.el や rinari.el, symfony.vim とか見ながら作ってます。 コードはgithub上にあります。 http://github.com/imakado/emacs-symfony/tree/master絶賛開発中でございます。 Installation `anything.el' ht…

conspとlistpの違い

(equal t (consp nil)) ;;=> nil (equal t (listp nil)) ;;=> t

いままで iモードID(guid, 個体識別番号)は大文字・小文字の区別ありなことを意識していなかった

いわゆる、かんたんログインと呼ばれる認証方法をドコモ端末で実装するときにつかわれていると思われるiモードIDですが、大文字・小文字の区別あり、だということを今日初めて知りました。以下、問題になった部分の最小構成。かんたんログインの是非はいった…

DBIC_TRACE=1のときに発行されるsqlにどこで発行されたクエリか追記する

package DBIx::Class::Storage::Statistics::Caller; use strict; use warnings; use base qw/ DBIx::Class::Storage::Statistics /; sub query_start { my ($self, $string, @bind) = @_; my $caller_sub_name = $self->_get_non_dbic_caller; my $message …

SQL扱うのに便利な関数とか、プレースホルダーを埋める関数とか

Arkのログ、DBIC_TRACE=1 の時に出るやつをごニョゴニョしたいと思って。いろいろやってみた。SELECT * FROM user me WHERE ( ( me.id = ? AND deleted = ? ) ): '4', '0'を選択して、 M-x sql-fill-placeholders すると、kill-ring にSELECT * FROM user me…