Skip to content

Instantly share code, notes, and snippets.

View suin's full-sized avatar
😃

suin

😃
  • Craftsman Software, Inc.
  • Japan Tokyo
View GitHub Profile
$ git blame -L 78,88 AdminSideMenu.class.php
29319ebd (minahito 2008-11-23 15:53:45 +0000 78)
29319ebd (minahito 2008-11-23 15:53:45 +0000 79) if ($this->mCurrentModule->get('dirname') == 'legacy') {
29319ebd (minahito 2008-11-23 15:53:45 +0000 80) if (xoops_getrequest('action') == "help") {
29319ebd (minahito 2008-11-23 15:53:45 +0000 81) $moduleHandler =& xoops_gethandler('module');
29319ebd (minahito 2008-11-23 15:53:45 +0000 82) $t_module =& $moduleHandler->getByDirname(xoops_gethandler('dirname'));
29319ebd (minahito 2008-11-23 15:53:45 +0000 83) if (is_object($t_module)) {
29319ebd (minahito 2008-11-23 15:53:45 +0000 84) $this->mCurrentModule =& $t_module;
29319ebd (minahito 2008-11-23 15:53:45 +0000 85) }
29319ebd (minahito 2008-11-23 15:53:45 +0000 86) }
#!/usr/bin/env php
=======================================
XoopsUnit Installer
=======================================
<?php
$installer = new XoopsUnitInstaller();
$installer->run();
class XoopsUnitInstaller
@suin
suin / gist:3137258
Created July 18, 2012 16:20
[update-query] token log example

https://github.com/suin/update-query

$ cat 20120719_0113~suin.apply_token 
-- [2012-07-19 01:13:44] update-query create 'suin'
-- [2012-07-19 01:13:58] update-query cat "20120719_0056_fuga.sql" >> "patch.suin.20120719_0113.sql"
-- [2012-07-19 01:13:58] update-query cat "20120719_0056_hoge.sql" >> "patch.suin.20120719_0113.sql"
-- [2012-07-19 01:13:58] update-query cat "20120719_0056_pugya.sql" >> "patch.suin.20120719_0113.sql"
-- [2012-07-19 01:13:58] update-query mv 20120719_0013~suin.apply_token 20120719_0113~suin.apply_token
#!/bin/bash
original_dir=$(pwd)
rm -rf /tmp/xoopsilex*
mkdir /tmp/xoopsilex || exit 1
cd /tmp/xoopsilex
git clone git://github.com/suin/xoopsilex-sample.git xoopsilex-sample-tmp
wget -O - https://github.com/xoopscube/legacy/tarball/r2_2_01_Beta_3 | tar xzf -
mkdir xoopsilex-sample || exit 1
mv xoopscube-legacy-*/* xoopsilex-sample/
<?php
class ChangeThemeByModule extends XCube_ActionFilter
{
public function postFilter()
{
$dirname = null;
if ( isset($this->mRoot->mContext->mModule->mXoopsModule) and is_object($this->mRoot->mContext->mModule->mXoopsModule) ) {
$dirname = $this->mRoot->mContext->mModule->mXoopsModule->get('dirname');
}
svn
# ディレクトリを作成して移動mkdir -p $HOME/local/src/subversion
cd $HOME/local/src/subversion/
# ソースDL
wget http://www.apache.org/dist/subversion/subversion-1.7.3.tar.gz
# 展開
tar xzf subversion-1.7.3.tar.gz
^_^) {/Users/suin) (5.4.5)
$ cd /tmp
^o^) {/tmp) (5.4.5)
$ git clone git://github.com/laruence/php-yaf.git
Cloning into 'php-yaf'...
remote: Counting objects: 407, done.
remote: Compressing objects: 100% (290/290), done.
remote: Total 407 (delta 203), reused 302 (delta 98)
Receiving objects: 100% (407/407), 215.75 KiB | 65 KiB/s, done.
^_^)/ {/tmp/php-yaf/tools/cg) (master) (5.4.5)
$ php yaf_cg
Yaf Code Generetor Version 1.0.0
Usage:
yaf_cg ApplicationName [ApplicationPath]
^_^)/ {/tmp/php-yaf/tools/cg) (master) (5.4.5)
$ php yaf_cg foo
DONE
@suin
suin / gist:3497946
Created August 28, 2012 13:26
(MacOS) sudo fs_usage <apache_proccess_id>
22:24:45.340122 accept F=3 F=60 0.000008 httpd.365955
22:24:45.340127 fcntl F=60 <GETFD> 0.000001 httpd.365955
22:24:45.340127 fcntl F=60 <SETFD> 0.000001 httpd.365955
22:24:45.340168 read F=60 [ 35] 0.000002 httpd.365955
22:24:45.341836 read F=60 B=0x1e7 0.000007 httpd.365955
22:24:45.341917 stat64
@suin
suin / SampleTest.php
Created September 24, 2012 08:46
PHPUnitとかで使えるかもしれないモックHTTPサーバー
<?php
function do_request($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
$result = curl_exec($ch);