Skip to content

Instantly share code, notes, and snippets.

View nojimage's full-sized avatar

Takashi Nojima nojimage

View GitHub Profile
@nojimage
nojimage / vhost.php
Created December 15, 2010 02:39
Output VirtualHost configuration file for Apache HTTPD (CakePHP Shell)
<?php
class VhostShell extends Shell {
public function main() {
$this->out('Vhost config maker for Apache HTTPD');
if (empty($this->args)) {
// show help
$this->help();
@nojimage
nojimage / nojimage.php
Created December 16, 2010 12:34
こうですかわかりません ><
<?php
/**
* Allways nojimage!
*/
class NojimageBehavior extends ModelBehavior {
public function beforeSave($model) {
foreach ($model->data[$model->alias] as $key => $value) {
$schema = $model->schema($key);
@nojimage
nojimage / virtual_field_collection.php
Created December 22, 2010 09:14
CakePHP VirttualFieldCollection Behavior
<?php
/**
* virtual field collection Behavior for CakePHP 1.3
*
* Copyright 2010, nojimage (http://php-tips.com/)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
@nojimage
nojimage / session_acl_component.php
Created January 14, 2011 11:12
CakePHP ACL Caching using Session
<?php
/**
* AclComponent using Session Cache for CakePHP 1.3
*
* Copyright 2011, nojimage (http://php-tips.com/)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
@nojimage
nojimage / gist:792999
Created January 24, 2011 09:17
よい子のみんなはこういうことしちゃいけないと思う
<?php
SomePluginController extends AppController {
function some_mehtod() {
$this->params['requested'] = true;
$params = Router::getParams();
$this->plugin = false;
$this->params['plugin'] = false;
$params['plugin'] = null;
@nojimage
nojimage / .htaccess
Created January 26, 2011 08:19
hide .ctp files, for BaserCMS
<FilesMatch "\.ctp$">
Order allow,deny
Deny from all
</FilesMatch>
@nojimage
nojimage / default.ctp
Created January 27, 2011 17:47
CakePHP Js::bufferメソッドを使う前提であれば、Js::setで値をJSへ渡すことが可能
<?php
// in layout/default.ctp
?>
<!-- // .. snip -->
<?php echo $this->Js->writeBuffer(); ?>
</body></html>
@nojimage
nojimage / app_email.php
Created February 1, 2011 11:28 — forked from monsat/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.
*
@nojimage
nojimage / textile.php
Created February 3, 2011 05:21
CakePHP TextileHelper
<?php
App::import('Vendor', 'classTextile', array('file' => 'classTextile.php'));
/**
*
* Textile Helper
*
* @author nojimage
* @see http://bakery.cakephp.org/articles/walker/2006/10/17/textile-2-0-0-helper
@nojimage
nojimage / ln.php
Created February 3, 2011 13:35
CakePHP LnShell - create plugin webroot symlink
<?php
/**
* Create symlink plugins and themes webroot to APP/webroot/
*
* CakePHP 1.3
* PHP versions 5
*
* Copyright 2011, nojimage (http://php-tips.com/)
*