Skip to content

Instantly share code, notes, and snippets.

@gomasaba
gomasaba / gist:1127907
Created August 5, 2011 16:24
CAKEPHP1.3のデフォルトCSSを少しスタイリッシュに・・・・。
/**
*
* Generic CSS for CakePHP
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
@gomasaba
gomasaba / gist:1130409
Created August 7, 2011 14:23
Codeigniter2.0.1でpaginationをpagerにしてみるメモ
<?php
require_once 'Pager.php';
class MY_Pagination{
var $params = array(
'mode' => 'sliding',
'perPage' => 10,
'delta' => 4,//現在のページの前後に表示するページ番号の数
'separator' => '',
'curPageLinkClassName' => 'current',
@gomasaba
gomasaba / gist:1146856
Created August 15, 2011 14:25
携帯用IPアドレスチェック
<?php
require_once 'Net/IPv4.php';
class IpCheck {
function gateway(){
//IPを設定する配列
$ip_table = array();
@gomasaba
gomasaba / gist:1258403
Created October 3, 2011 03:54
CakephpでテストデータにYamlを簡単に使う方法メモ

php-yaml がなければインストール

  • centos5
yum install php-pecl-yaml

Test/Case/Fixture/***Fixture.phpを変更

@gomasaba
gomasaba / gist:1262163
Created October 4, 2011 16:54
cake2で独自のエラーテンプレートを作りたいときのメモ
class ExampleException extends CakeException {
/**
 * Constructor
 *
 * @param string $message If no message is given 'Not Found' will be the message
 * @param string $code Status code, defaults to 404
 */
	public function __construct($message = null, $code = 404) {
		if (empty($message)) {
@gomasaba
gomasaba / gist:1332913
Created November 2, 2011 05:09
WEBでタイムスタンプとか・・・確認したいとか・・・
<html>
<head>
<style type="text/css">
/* Set up custom font and form width */
body {
margin-left: 10px;
font-family: Arial,sans-serif;
font-size: small;
}
@gomasaba
gomasaba / gist:1366065
Created November 15, 2011 03:43
簡易なサーバーモニタリングシェルのメモ
<?php
/**
* サーバー監視シェル
* Gmail経由でメール送信
*
* @author ootatter
*/
App::uses('CakeEmail', 'Network/Email');
App::uses('ConnectionManager', 'Model');
@gomasaba
gomasaba / gist:1523835
Created December 27, 2011 14:37
vimの設定メモ
syntax on
set autoindent
set number
if has('gui_macvim')
set showtabline=2 " タブを常に表示
set imdisable " IMを無効に
set antialias " アンチエイリアスを有効に
set cindent " Cインデントを利用
set expandtab " タブを空白文字で
#! /bin/sh
set -e
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/user/bin
NAME=nginx
DESC="nginx deamon"
DAEMON=/usr/sbin/$NAME
SCRIPTNAME=/etc/init.d/$NAME
@gomasaba
gomasaba / LC_Page_Admin_Products_Product_Ex.php
Created January 11, 2013 11:34
ECCUBEで管理画面に前後の商品リンクメモ
/**
* 前後の商品
*
*/
public function neighbors($product_id){
$objQuery =& SC_Query_Ex::getSingletonInstance();
//prev
$objQuery->setOrder('product_id DESC');
$objQuery->setLimit('1');