Skip to content

Instantly share code, notes, and snippets.

228c228
< if (!preg_match('/^(https?|file):\/\/+/i', $url)) {
---
> if (!preg_match('/^https?:\/\/\w[\w\-\.]+/i', $url)) {
231d230
<
233,434c232,239
< if (preg_match('/^https?:\/\/\w[\w\-\.]+/i', $url)) {
< $cache_lifetime = (int) $cache_lifetime;
< $use_cache = !empty($this->cacheDir) and $cache_lifetime > 0;
@kaz29
kaz29 / apc_install.sh
Created May 28, 2011 06:11
CakePHP setup on NiftyCloud
#!/bin/sh
# APCをインストール
pecl install apc
cat <<_EOT_ 1>/etc/php.d/apc.ini
extension=apc.so
_EOT_
service httpd restart
@kaz29
kaz29 / cakephp2_on_nifyucloud_centos5_6.sh
Created October 13, 2011 16:40
CakePHP2.0.0 setup on NiftyCloud CentOS5.6
#!/bin/sh
CAKEPHP_PAH=/usr/local/app
if [ ! -d $CAKEPHP_PAH ]
then
mkdir $CAKEPHP_PAH
fi
# IPアドレスを取得
IPADDR=`ip addr show | grep eth0 | grep 'inet *' | awk '{print $2;}' | cut -f1 -d '/'`
@kaz29
kaz29 / Controller_InstancesController.php
Created October 15, 2011 07:57
PHPMatsuri2011 NiftyCloud Workshop
<?php
// メンバ変数を追加
public $uses = array(
'NiftyCloudControllPanel.Instance',
'NiftyCloudControllPanel.KeyPair',
'NiftyCloudControllPanel.SecurityGroup',
);
/// アクションを追加
public function run($id=null)
@kaz29
kaz29 / step 1
Created October 15, 2011 13:21
PHPMatsuri2011 NiftyCloud Workshop2
cd /usr/local/app/cakephp/vendors/
git clone git://github.com/kaz29/unofficial-niftycloud-sdk-for-php.git \
NiftyCloud
@kaz29
kaz29 / startup.sh
Created October 28, 2011 06:10
CakePHP2.0.0 setup on NiftyCloud CentOS5.6 plain startup script
#!/bin/sh
# CakePHP2.0 setup script
# Only for CentOS 5.6 64bit Plain
/bin/cat <<EOF >> /etc/rc.d/rc.local
curl https://raw.github.com/gist/1284739/2fbed6559815413523cda708d99eb18f9926428a/cakephp2_on_nifyucloud_centos5_6.sh | sh | tee /root/_setup.log
/bin/sed -i.orig -e "s/curl/#curl/g" /etc/rc.d/rc.local
/bin/sed -i.orig -e "s/\/bin\/sed/#\/bin\/sed/g" /etc/rc.d/rc.local
EOF
@kaz29
kaz29 / find-1.php
Created December 14, 2011 10:45
CakePHP Advent Calendar 2011/12/14
<?php
// @ operator
// compare to circle
$conditions = array(
'loc @' => array('circle' => array('point'=> array(10.1,10.1), 100)),
);
// order by distance
$order = array(
'loc <-> point(10.1,10.1)'
);
@kaz29
kaz29 / cakephp2.sh
Created January 8, 2012 01:50
CakePHP Setup Script for NiftyCloud - Ubuntu 10.04 64bit Plain
#!/bin/sh
export CAKEPHP_VERSION=2.0.5
export CAKEPHP_PATH=/usr/local/app
if [ ! -d $CAKEPHP_PATH ]
then
mkdir $CAKEPHP_PATH
fi
# IPアドレスを取得
@kaz29
kaz29 / basercms.sh
Created January 8, 2012 08:43
baserCMS Setup Script for NiftyCloud - Ubuntu 10.04 64bit Plain
#!/bin/sh
export BASERCMS_PATH=/usr/local/app
if [ ! -d $BASERCMS_PATH ]
then
mkdir $BASERCMS_PATH
fi
# IPアドレスを取得
export IPADDR=`ip addr show | grep eth0 | grep 'inet *' | awk '{print $2;}' | cut -f1 -d '/'`
@kaz29
kaz29 / td-agetnt.sh
Created January 12, 2012 00:35
td-agent setup for NiftyCloud - CentOS 5.6 64bit Plain
#!/bin/sh
# apache,fluent-plugin-s2が依存するパッケージをインストール
yum -y install httpd.x86_64 \
libxml2-devel.x86_64 libxslt-devel.x86_64
# td-agent 用のリポジトリを登録
cat <<_EOT_ 1>/etc/yum.repos.d/td.repo
[treasuredata]
name=TreasureData