Skip to content

Instantly share code, notes, and snippets.

@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
@kaz29
kaz29 / git-completion.bash
Created March 28, 2012 06:58
git-completion.bash
#!bash
#
# bash completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
@kaz29
kaz29 / EncryptBehavior.php
Created April 21, 2012 01:38
EncryptBehavior for CakePHP2.x
<?php
/**
* Encrypt behavior
*
*/
class EncryptBehavior extends ModelBehavior {
// Encryption settings
const CIPHER = MCRYPT_RIJNDAEL_128;
const MODE = MCRYPT_MODE_CBC;
@kaz29
kaz29 / MyTestSegue.m
Created June 4, 2012 04:47
StoryBoard sample
//
// MyTestSegue.m
// StoryBoardTest
//
#import "MyTestSegue.h"
@implementation MyTestSegue
- (void)perform
@kaz29
kaz29 / gist:3776212
Created September 24, 2012 14:27
CakePHP nginx.conf sample
location / {
index index.php index.html index.htm;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?url=$1 last;
break;
}
}
location ~ .php(/|$) {
fastcgi_split_path_info ^(.+\.php)(.*)$;
@kaz29
kaz29 / CoMeeting.php
Created November 14, 2012 06:58
co-meeting hack
<?php
// 大分やっつけ感がある感じ...orz
class CoMeeting {
private $url = 'https://www.co-meeting.com';
private $cookie = null;
private $params = null;
public function __construct($config='config.php')
{
include($config);
@kaz29
kaz29 / CoMeeting.php
Last active December 9, 2015 22:28
co-meeting hack $ php list_groups.php でグループ一覧(グループ名、グループID、未読数)が表示されます。 cURLが必要です。
<?php
// 大分やっつけ感がある感じ...orz
class CoMeeting {
private $url = 'https://www.co-meeting.com';
private $cookie = null;
private $params = null;
public function __construct($config='config.php')
{
include($config);