Skip to content

Instantly share code, notes, and snippets.

View ounziw's full-sized avatar

Fumito Mizuno ounziw

View GitHub Profile
@ounziw
ounziw / html2rest.py
Created October 6, 2011 23:42 — forked from kenjis/html2rest.py
html2rest for CodeIgniter User Guide
#-----------------------------------------------------------------------------
# Copyright (c) 2006-2009 Gerard Flanagan
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
@ounziw
ounziw / WordPress Shortcode
Created May 28, 2012 06:52 — forked from gatespace/datecontent-shortcode.php
WordPressの本文の内容を指定日時によって表示するショートコード
/**
* 指定日時によって内容を表示するショートコード
*/
// [datecontent opendate="YmdH" closeDate="YmdH"]
function datecontent_func($atts, $content = null) {
$nowdate = date_i18n("YmdH"); // 現在の時間を取得
extract(shortcode_atts(array(
'opendate' => null,
'closedate' => null,
), $atts));
<?php
namespace Fuel\Migrations;
class Create_users
{
public function up()
{
\DBUtil::create_table('users', array(
'id' => array('constraint' => 11, 'type' => 'int', 'auto_increment' => true),
@ounziw
ounziw / page_template_css.php
Last active October 6, 2015 07:28
テンプレート階層に応じたスタイルシートを出力する
/**
* @author Fumito MIZUNO http://php-web.net/
* @license GPL ver.2 or later {@link http://www.gnu.org/copyleft/gpl.html}
*/
add_action('wp_head','page_template_css') ;
function page_template_css() {
global $template;
$dir = '/css'; // (テーマ配下の)スタイルシートを入れるディレクトリを設定する
$pos = strrpos($template, "/");
$template = substr($template, $pos);
@ounziw
ounziw / empty-db-mamp-pro
Created July 10, 2012 06:10
Mamp Pro でデータベースを空にする (selenium 利用)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://localhost:8888/" />
<title>mamp</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
@ounziw
ounziw / gist:3730738
Created September 16, 2012 01:57
debugging translation for concrete5.6
<?php
defined('C5_EXECUTE') or die("Access Denied.");
// Put this file into concrete/startup/localization.php
function remove_percent_from_text($text) {
$removed = array('$','%');
$no_var_text = str_replace($removed,'_',$text);
$no_var_text .= ' '; // Space for Readability
return $no_var_text;
}
@ounziw
ounziw / gist:3808882
Created October 1, 2012 00:54
twentytwelve 1.0 日本語
<?php
/**
* Translated by Fumito MIZUNO ( http://ounziw.com/ )
* License for translation: CC-BY-SA
*/
/**
* Twenty Twelve 関数と定義
*
* テーマをセットアップし、ヘルパー関数を提供する。
* ヘルパー関数はテーマでカスタムテンプレートタグとして使用する。
@ounziw
ounziw / login
Created November 7, 2012 00:45
Test WordPress login from FuelPHP
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type" />
<title>Test Suite</title>
</head>
<body>
<table id="suiteTable" cellpadding="1" cellspacing="1" border="1" class="selenium"><tbody>
<tr><td><b>Test Suite</b></td></tr>
<?php
class WpautopTest extends PHPUnit_Framework_TestCase {
function autop_provider()
{
return array(
array("<div>abcde\n\n</div>","<div>abcde\n</div>\n"),
array("<section>abcde\n\n</section>","<section>abcde\n</section>\n"),
);
}
@ounziw
ounziw / foundation.view.php
Last active December 27, 2015 17:48
Novius OS Form: view data you have entered, when you click next page link.
<?php
// put this file into local/views/apps/noviusos_form
// License: AGPL ver3.0 or later
$css = <<<EOS
dl.check_before_send dt {
float: left;
clear: left;
width: 200px;