Skip to content

Instantly share code, notes, and snippets.


Norio Suzuki suzuki

View GitHub Profile
suzuki / build.xml
Created Mar 26, 2012
Sorted filelist for Phing
View build.xml
<?xml version="1.0" encoding="utf-8" ?>
<project name="sorted-filelist" basedir="." default="all">
<target name="all" depends="use-fileset, use-find" />
<!-- fileset version -->
<!-- no sort -->
<target name="use-fileset">
<foreach param="filename" target="echo-filename">
<fileset dir="./testdir">
suzuki / gist:2203180
Created Mar 26, 2012
sample data for gist:2203147
View gist:2203180
$ mkdir testdir
$ cd testdir
$ touch touch 22test.txt
$ touch touch 10test.txt
$ touch touch 40test.txt
$ touch touch 30test.txt
suzuki / gist:2203185
Created Mar 26, 2012
result for gist:2203147
View gist:2203185
$ phing
Buildfile: /home/suzuki/build.xml
sorted-filelist > use-fileset:
[foreach] Calling Buildfile '/home/suzuki/build.xml' with target 'echo-filename'
sorted-filelist > echo-filename:
[echo] Filename is 22test.txt
#!/usr/bin/env perl
use strict;
use warnings;
use Pod::Usage;
use Text::Markdown 'markdown';
use HTML::TreeBuilder;
use List::Util 'max';
#!/usr/bin/env perl
use strict;
use warnings;
use Pod::Usage;
use Text::Markdown 'markdown';
use HTML::TreeBuilder;
use List::Util 'max';
suzuki / gist:2288154
Created Apr 3, 2012
Detect charset from MIME string
View gist:2288154
* Detect charset from MIME string
* @params string
* @return mixed found a charset string (upper case) or couldn't found false
public function getCharsetFromMimeString($mimeString) {
$mimeString = trim($mimeString);
if (preg_match('/^=\?([^?]+)\?(:?B|Q)\?[^?]+\?=$/', $mimeString, $matched)){
return strtoupper($matched[1]);
suzuki / gist:2657241
Created May 11, 2012
View gist:2657241
(defun split-window-vertically-one-third()
"Split the selected window into two windows, one above the other, size is one third of window-heihgt"
(split-window-vertically (/ (window-height) 3)))
(global-set-key "\C-x2" 'split-window-vertically-one-third)
suzuki / gist:2715870
Created May 17, 2012
CandyCane with PostgreSQL
View gist:2715870
$ git diff app/Model/Project.php
diff --git a/app/Model/Project.php b/app/Model/Project.php
index af47298..fa9c98e 100755
--- a/app/Model/Project.php
+++ b/app/Model/Project.php
@@ -329,7 +329,7 @@ class Project extends AppModel {
$enabledModuleTable = $this->EnabledModule->tablePrefix . $this->EnabledModule->table;
$emName = $perm['project_module'];
- $base_statement[] = array("EXISTS (SELECT FROM $enabledModuleTable em WHERE'$emName' AND em.project_id=$" => true);
suzuki / gist:2760759
Created May 21, 2012
An idea of CakeEmail content-type detection
View gist:2760759
protected function _getContentTypeCharset() {
switch($this->charset) {
case 'iso-2022-jp-ms':
$charset = 'iso-2022-jp';
$charset = $this->charset;
return $charset;
View gist:4425864
500 Internal Server Error
cannot load such file -- pygments (LoadError)
/usr/local/rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/usr/local/rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/home/tdiary/tdiary/core/tdiary/style/gfm_style.rb:24:in `block_code'
/home/tdiary/tdiary/core/tdiary/style/gfm_style.rb:120:in `render'
/home/tdiary/tdiary/core/tdiary/style/gfm_style.rb:120:in `to_html'
/home/tdiary/tdiary/core/tdiary/style/gfm_style.rb:50:in `initialize'
You can’t perform that action at this time.