Skip to content

Instantly share code, notes, and snippets.

View show555's full-sized avatar

Shogo Kato show555

  • Akita-shi Akita, JAPAN
View GitHub Profile
@keesiemeijer
keesiemeijer / setup-phpunit.sh
Last active December 8, 2023 11:02
Setup PHPUnit for use in the Local by Flywheel app
#!/usr/bin/env bash
# ===============================================================================
# Script to install PHPUnit in the Local by Flywheel Mac app
# These packages are installed
#
# PHPUnit, curl wget, rsync, git, subversion and composer.
#
# WordPress is installed in the `/tmp/wordpress` directory for use by PHPUnit.
# The WordPress test suite is installed in the `/tmp/wordpress-tests-lib` directory.
@YukiYamashina
YukiYamashina / README.md
Last active October 21, 2020 08:45
QdmailをPHP7.0に対応させる

QdmailをPHP7.0に対応させる

  • コンストラクタ名を__constructorに修正
  • newの前の&を削除
  • QdmailComponent内のfunction & smtpObjectの引数をスーパークラスと合わせて$null = falseに修正
  • HTMLメールでのマルチパート順序をhtml, plain, OMITからplain, html, OMITへ変更
  • iPhone用アドレスをi.softbank.ne.jpからi.softbank.jpに修正
@cou929
cou929 / detect-private-browsing.js
Last active May 1, 2024 21:07
Detect private browsing mode (InPrivate Browsing or Incognito).
function retry(isDone, next) {
var current_trial = 0, max_retry = 50, interval = 10, is_timeout = false;
var id = window.setInterval(
function() {
if (isDone()) {
window.clearInterval(id);
next(is_timeout);
}
if (current_trial++ > max_retry) {
window.clearInterval(id);
@yuitowest
yuitowest / install_vagrant_vmware_fusion.md
Last active December 15, 2015 20:19
Vagrantが1.1でVMware Fusion向けプラグインを公開したので試した。

Vagrantの最新版をインストール

$ vagrant -v
Vagrant version 1.1.5
@pimpmywp
pimpmywp / class-pm-scripts.php
Last active December 11, 2015 11:18
[WordPress] wp_enqueue_script(), wp_enqueue_styles() で出力されるタグからtype属性を除いてHTML5ぽくしつつ、scriptタグでも条件付きコメントを使えるようにする
<?php
if ( ! class_exists( 'PM_Scripts' ) ) {
class PM_Scripts Extends WP_Scripts {
public function __construct() {
parent :: __construct();
}
public function print_extra_script( $handle, $echo = true ) {
if ( !$output = $this->get_data( $handle, 'data' ) )
return;
@pimpmywp
pimpmywp / class-pm-schedule-post.php
Created December 29, 2012 08:21
[WordPress] 記事の公開開始日時・公開終了日時をカスタムフィールドで個別/同時に指定する
<?php
if ( ! class_exists( 'PM_Schedule_Post' ) ) {
class PM_Schedule_Post {
protected $from = '';
protected $to = '';
protected $label = '';
public function __construct( $from, $to, $label = 'expired' ) {
$this->from = $from;
$this->to = $to;

#Backbone.jsでUIバインディング

Backbone.js Advent Calendarの14日目です。

Backbone.jsはAngularJSのようなUIバインディングを持たないので自分でバインドしなければなりません。 例えば、テキストボックスの入力内容をモデルに格納して、さらにモデルの内容を別のDOM要素に表示する、 というのはこんな感じかと思います。

@wokamoto
wokamoto / replace-siteurl.php
Created September 4, 2012 23:22
WordPress のDB上のサイトURLを一気に変換
#!/usr/bin/php
<?php
switch($argc) {
case 1:
case 2:
echo "please input new site url and wp directory name!\n";
exit();
default:
$old_site = isset($argv[3]) ? $argv[3] : '';
$path = $argv[2];
@wokamoto
wokamoto / wp_get_social_counts.php
Created April 25, 2012 01:43
WordPress で記事のツイート数を取得する
<?php
/*
* Get Social Button Count twitter
*/
function get_social_counts( $url ){
$transient_key = md5('get_social_counts-' . $url);
// get cache
if ( false === ($counts = get_transient($transient_key)) ) {
$counts = array();
@k-holy
k-holy / Loader.php
Created January 31, 2012 01:15
PSR-0対応Autoloader
<?php
/**
* PHP versions 5
*
* @copyright 2011 k-holy <k.holy74@gmail.com>
* @author k.holy74@gmail.com
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
*/
namespace Holy;