Skip to content

Instantly share code, notes, and snippets.

View handlename's full-sized avatar

NAGATA Hiroaki handlename

View GitHub Profile
@handlename
handlename / sgrep.pl
Created November 26, 2010 17:20
utf8なコマンドラインからjsisのファイルを直接grepしたいときに使うのかも
#!/usr/bin/env perl
use strict;
use warnings;
use Encode;
use File::Find;
use Term::ANSIColor::Print;
my @targets = split /,/, $ARGV[0];
@handlename
handlename / html-helper-mode.diff
Created November 11, 2010 15:48
for html-helper-mode 3.0.4kilo
*** html-helper-mode_default.el 2004-05-17 01:01:09.000000000 +0900
--- html-helper-mode.el 2010-11-11 16:51:48.000000000 +0900
***************
*** 310,316 ****
(defvar html-helper-new-PHP-buffer-template
'("<html> <head>\n"
! "<? PHP\n\n?>"
"</head><body>\n"
"<? /* " html-helper-timestamp-start "\n\n"
@handlename
handlename / is_deeply.php
Created October 29, 2010 17:04
better is_deeply
<?php
function is_deeply($a, $b, $diff = array(), $key_str = '') {
ksort($a);
ksort($b);
$keys = array_unique(
array_merge(
array_keys($a),
array_keys($b)
<?php
function getFileList($dir_path)
{
if(! is_dir($dir_path))
{
return array();
}
$list = array();
#!/usr/bin/php
<?php
$text = file_get_contents('php://stdin');
$text = preg_replace('/<\/?div[^>]*\/?>/', '', $text);
$text = preg_replace('/<\/?a[^>]*>/', '', $text);
$text = preg_replace('/<span[^\/]+\/span>/', '', $text);
$text = preg_replace('/ id="[^"]*"/', '', $text);
config/environment.yml:
class: sfDefineEnvironmentConfigHandler
param:
prefix: app_
<?php
class myEnvironmentConfigFilter extends sfFilter
{
public function execute($filterChain)
{
if ($this->isFirstCall()) {
include(sfContext::getInstance()->getConfigCache()->checkConfig(sfConfig::get('sf_config_dir').'/environment.yml'));
}
myEnvironmentConfigFilter:
class: myEnvironmentConfigFilter
<?php
class kayacActions extends sfActions
{
public function executeError(sfWebRequest $request)
{
// 問答無用でエラーレスポンス
$this->forwardError('500', 'エラーメッセージ');
}
<?php
class sharedActions extends sfActions
{
/*
* エラーレスポンス
*
* @param sfWebRequest $request
*/
public function executeError(sfWebRequest $request)