Skip to content

Instantly share code, notes, and snippets.

View monsat's full-sized avatar

TANAKA Kohji monsat

View GitHub Profile
@monsat
monsat / app_email.php
Created April 14, 2010 07:15 — forked from nojimage/app_email.php
CakePHP version 1.3.x EmailComponent for Japanese
<?php
/**
*
* AppEmailComponent (for Japanese)
*
* Copyright 2010, nojimage (http://php-tips.com/)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
@monsat
monsat / jquery.pluginname.js
Created July 16, 2011 05:34
initial of jquery plugin
(function($) {
$.fn.pluginname = function(options) {
// build main options before element iteration
var opts = $.extend({}, $.fn.pluginname.defaults, options);
opts.debug && debug(this);
// iterate and reformat each matched element
return this.each(function() {
$this = $(this);
});
};
@monsat
monsat / delete_cache.sh
Created August 4, 2011 02:33
delete all cache files on CakePHP's app
#!/bin/sh
cd /path/to/your_app_root
# ls
# cake app ...
find ./*/tmp/cache -type f \( -name 'cake_*' -o -name 'element_*' -o -name '*.*' \) -exec rm {} \;
@monsat
monsat / change_mode_of_tmp.sh
Created August 4, 2011 02:39
Change mode of tmp dir on CakePHP
#!/bin/sh
cd /path/to/your_app_root
# ls
# cake app ...
find app/tmp -type d -exec chmod 0777 {} \;
@monsat
monsat / gist:1133729
Created August 9, 2011 10:36
pagination with query string by CakePHP2.0
# AnyController.php
var $paginate = array(
'paramType' => 'querystring',
);
@monsat
monsat / gist:1143625
Created August 13, 2011 08:35
"git log-all" is command for viewing logs with branch tree
# via http://d.hatena.ne.jp/yukioc/20090920/1253413686
git config --global alias.log-all "log --graph --all --color --pretty='%x09%h %cn%x09%s %Cred%d%Creset'"
@monsat
monsat / SampleHelperTest.php
Created August 22, 2011 02:38
Skeleton file of Helper Test Case for CakePHP2.0 (beta)
<?php
App::uses('View', 'View');
App::uses('SampleHelper', 'View/Helper');
class SampleHelperTestCase extends CakeTestCase {
public function setUp() {
parent::setUp();
$this->View = new View(null);
@monsat
monsat / gist:1161580
Created August 22, 2011 03:15
test of protected method
<?php
// insert this class and
// $this->Sample = new SampleExposed();
class SampleExposed extends Sample {
public function __call($method, array $args = array()) {
if (!method_exists($this, $method))
throw new BadMethodCallException("method '$method' does not exist");
return call_user_func_array(array($this, $method), $args);
}
}
@monsat
monsat / git-submodule.sh
Created August 24, 2011 01:16
update submodules
#!/bin/sh
git pull
git submodule sync
git submodule update --init
@monsat
monsat / gist:1175106
Created August 27, 2011 07:37
no cache by CakePHP1.x
<div>
<cake:noncache>
<?php echo $this->Session->read('Auth.User.username'); ?>
</cake:nocache>
</div>