Skip to content

Instantly share code, notes, and snippets.

mt8.biz mt8

Block or report user

Report or block mt8

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mt8
mt8 / plugin.php
Created Feb 3, 2017
特定のWordPressプラグインを管理画面メニューでON/OFFするプラグイン
View plugin.php
<?php
/*
* Plugin Name: Plugin On Off
*/
$poo = new Plugin_On_Off();
$poo->register_hooks();
class Plugin_On_Off {
@mt8
mt8 / php-build.patch
Last active Oct 19, 2016
phpenv + php-build で libphp5.so をapatcheモジュールにコピーしないためのパッチ v0.11.0dev対応
View php-build.patch
diff --git bin/php-build bin/php-build
index 273a11a..60fe31a 100755
--- bin/php-build
+++ bin/php-build
@@ -334,6 +334,10 @@ function build_package() {
cd "$source_path"
{
+ if which apxs > /dev/null 2>&1; then
+ _LIBEXECDIR=`apxs -q LIBEXECDIR`
@mt8
mt8 / functions.php
Last active Jul 20, 2016
[WordPress] カスタム投稿タイプのアーカイブ件数を変更する
View functions.php
<?php
function set_cpt_per_page( $query ) {
$cpt = 'news';
$per_page = 10;
if ( ! is_admin() && $query->is_main_query() && is_post_type_archive( $cpt ) ) {
$query->set( 'posts_per_page', $per_page );
}
}
add_action( 'pre_get_posts', 'set_cpt_per_page' );
@mt8
mt8 / lambda_function.py
Last active Oct 4, 2017
[AWS] Lambdaで出力したCloudWatchログのログストリームURLをLambda内で取得するPython(エラー調査などに便利)
View lambda_function.py
def lambda_handler(event, context):
region = context.invoked_function_arn.split(":")[3]
request_id = context.aws_request_id
log_group_name = context.log_group_name
log_stream_name = context.log_stream_name
log_url = "https://"+region+".console.aws.amazon.com/cloudwatch/home?region="+region+"#logEvent:group="+log_group_name+";stream="+log_stream_name
print log_url
@mt8
mt8 / _ide_helper.php
Created May 5, 2016 — forked from barryvdh/_ide_helper.php
Laravel IDE Helper for Netbeans / PhpStorm / Sublime Text 2 CodeIntel, generated using https://github.com/barryvdh/laravel-ide-helper
View _ide_helper.php
<?php
/**
* A helper file for Laravel 5, to provide autocomplete information to your IDE
* Generated for Laravel 5.1.31 (LTS) on 2016-03-01.
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
View colored-admin-mw-wp-form-data-list
if ( ! function_exists( 'mw_wp_form_colored_status' ) ) :
function mw_wp_form_colored_status( $classes, $class, $ID )
{
if ( ! in_array( 'mw-wp-form/mw-wp-form.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
return $classes;
}
if ( 'edit.php' !== basename( $_SERVER['PHP_SELF'] ) ) {
return $classes;
}
if ( ! isset( $_REQUEST['post_type'] ) || ! post_type_exists( $_REQUEST['post_type'] ) || false === strpos( $_REQUEST['post_type'], MWF_Config::DBDATA ) ) {
View fc2_comment_clean_4_wordpress.php
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>FC2ブログからWordPressにインポートしたらコメント文が変になった人が自己責任で実行するやつ</title>
<link rel="stylesheet" href="wp-admin/css/install.css" type="text/css" />
</head>
<body>
<h1>FC2ブログからWordPressにインポートしたらコメント文が変になった人が自己責任で実行するやつ</h1>
<h2>SECRET: *とか、PASS: *******とかが出ちゃう人へ。。。</h2>
You can’t perform that action at this time.