Skip to content

Instantly share code, notes, and snippets.

View nojimage's full-sized avatar

Takashi Nojima nojimage

View GitHub Profile
@nojimage
nojimage / accesscheck.php.patch
Created February 18, 2011 13:27
for LoudBlog 0.8.1a
diff --git a/loudblog/inc/accesscheck.php b/loudblog/inc/accesscheck.php
index 01f43f9..457eb0e 100644
--- a/loudblog/inc/accesscheck.php
+++ b/loudblog/inc/accesscheck.php
@@ -68,15 +68,15 @@ else {
//compare with the login-data from session and from post
foreach ($result as $row) {
if ((isset($_SESSION['nickname']))
- AND ($row['nickname'] == $_SESSION['nickname'])
- AND ($row['password'] == $_SESSION['password'] OR $row['password'] == md5($_SESSION['password']))
@nojimage
nojimage / functions.php
Created March 2, 2011 02:34
WPでソーシャルボタンをハードに追加するサンプル
<?php
/* ..snip.. */
/* ここでは df_social として関数を定義していますけど適当な名前でOKです */
function df_social() {
?>
<div class="socialLink">
<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-url="<?php the_permalink(); ?>" data-text="<?php the_title(); ?>" data-via="{あなたのアカウント}">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
<a href="http://b.hatena.ne.jp/entry/<?php the_permalink(); ?>" class="hatena-bookmark-button" data-hatena-bookmark-title="<?php the_title(); ?>" data-hatena-bookmark-layout="standard" title="このエントリーをはてなブックマークに追加"><img src="http://b.st-hatena.com/images/entry-button/button-only.gif" alt="このエントリーをはてなブックマークに追加" width="20" height="20" style="border: none;" /></a><script type="text/javascript" src="http://b.st-hatena.com/js/bookmark_button.js" charset="utf-8" async="async"></script>
<iframe src="http://www.facebook.com/plugins/like.php?href=<?= urlencode(get_permalink()) ?>&amp;layout=button_count&amp;show_faces=true&amp;wi
@nojimage
nojimage / jquery.socialbutton.js
Created March 25, 2011 12:35
jquery.socialbutton.js add tumblr button
/**
* jquery.socialbutton - jQuery plugin for social networking websites
* http://itra.jp/jquery_socialbutton_plugin/
*
* Copyright 2010, Itrans, Inc. http://itra.jp/
*
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Version: 1.7.3
@nojimage
nojimage / any_view.ctp
Created April 1, 2011 03:59
for April fool setting
<!-- ..snip.. -->
<?php if (Configure::read('AprilFool')) : ?>
fool content write here!
<?php endif; ?>
<?php __('Any Message'); ?>
<!-- ..snip.. -->
@nojimage
nojimage / org.macports.zabbix_agent.plist
Created April 6, 2011 07:18
auto startup zabbix agent on Mac OS X (macports)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.macports.zabbix_agent</string>
<key>ProgramArguments</key>
<array>
<string>/opt/local/share/zabbix/zabbix_agentd.init</string>
@nojimage
nojimage / org.jenkins-ci.jenkins.plist
Created April 7, 2011 03:25
Jenkins CI LaunchDaemon plist file (Mac OSX with macports)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UserName</key>
<string>jenkins</string>
<key>Label</key>
<string>org.jenkins-ci.jenkins</string>
<key>EnvironmentVariables</key>
<dict>
@nojimage
nojimage / makedesignextension.sh
Created April 18, 2011 03:17
create eZ Publish design extension
#!/bin/bash
# help print
function print_usage {
echo ""
echo "$0 <extension_name>"
}
if [ $# != 1 ]; then
print_usage
@nojimage
nojimage / form.php
Created May 3, 2011 13:21
cake/libs/view/helpers/form.php
<?php
/**
* Automatic generation of HTML FORMs from given data.
*
* Used for scaffolding.
*
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
@nojimage
nojimage / gist:967840
Created May 12, 2011 02:45
改行(LF 0x0A, CR 0x0D)、水平タブ(HT 0x09)以外の制御文字にマッチする正規表現
[\x00-\x08]|[\x0B\x0C]|[\x0E-\x1F]|\x7F|[\x{2028}\x{2029}]
class Stagehand_TestRunner_CakeSkipTest extends CakeTestCase
{
public function skip()
{
$this->skipIf(true, 'This is an skip message.');
}
public function testPass()
{
$this->assertTrue(true);