Skip to content

Instantly share code, notes, and snippets.

View k4zuki02h4t4's full-sized avatar
🏠
家で働く

KAZUKI Otsuhata k4zuki02h4t4

🏠
家で働く
View GitHub Profile
@k4zuki02h4t4
k4zuki02h4t4 / mc.sh
Created April 7, 2018 10:26
Minecraft command.
cd /opt/minecraft_server/ && \
wget http://files.minecraftforge.net/maven/net/minecraftforge/forge/1.12.2-14.23.2.2611/forge-1.12.2-14.23.2.2611-installer.jar && \
wget http://files.minecraftforge.net/maven/net/minecraftforge/forge/1.12.2-14.23.2.2611/forge-1.12.2-14.23.2.2611-universal.jar && \
java -jar ./forge-1.12.2-14.23.2.2611-installer.jar nogui --installServer && \
rm -rf forge-1.12.2-14.23.2.2611-installer.jar && \
rm -rf forge-1.12.2-14.23.2.2611-installer.jar.log && \
rm -rf minecraft_server.jar && \
mv forge-1.12.2-14.23.2.2611-universal.jar minecraft_server.jar && \
systemctl restart minecraft-server
@k4zuki02h4t4
k4zuki02h4t4 / .gitignore
Last active March 16, 2018 07:15
Gitignore for WordPress.
i*~
*.bak
*.org
*.log
Thumbs.db
desktop.ini
.DS_Store
.buildpath
.project
.settings
@k4zuki02h4t4
k4zuki02h4t4 / .php
Last active November 20, 2017 03:46
[WordPress] How to add custom field to taxonomy.
<?php
/**
* Add custom fields to term.
*/
function kaleidpixel_add_term_form_fields() {
if ( 1 < did_action( 'category_add_form_fields' ) ) {
return;
}
?>
@k4zuki02h4t4
k4zuki02h4t4 / wordmove_with_localbyflywheel.sh
Last active January 30, 2021 07:37
Enable Wordmove with "Local by Flywheel".
#!/usr/bin/env bash
set -xu
RUBY_VERSION=2.4.1
LIBSSL_VERSION=$(dpkg -s libssl1.0.0 | grep -i ^version | awk '{print $2;}')
apt-get update -y
apt-get upgrade -y
apt-get install -y software-properties-common python-software-properties vim build-essential git python-setuptools ruby-build libssl-dev=${LIBSSL_VERSION}
<?php
/**
* BAPT - Add MW WP Form save data button.
*
* @param $post_type
*/
function bapt_add_mwwpform_save_data_button( $post_type ) {
if ( 'mw-wp-form' !== $post_type || ! class_exists( 'MW_WP_Form_Contact_Data_Setting' ) ) {
return;
}
@k4zuki02h4t4
k4zuki02h4t4 / .php
Created May 18, 2017 03:42
[WordPress] Play YouTube video inline on iOS.
<?php
/**
* Play YouTube video inline on iOS.
*/
add_filter( 'oembed_dataparse', function ( $return, $data ) {
if ( is_object( $data ) && 'YouTube' === $data->provider_name && ! empty( $data->html ) && is_string( $data->html ) ) {
$return = preg_replace( '/src="([^"]+)"/', 'src="$1&playsinline=1"', $data->html );
}
return $return;
@k4zuki02h4t4
k4zuki02h4t4 / .php
Created May 6, 2017 10:08
WordPress redirect。
<?php
function vasimpleredirect_redirect() {
global $post, $pagenow;
if ( is_admin() || is_user_logged_in() || 'wp-login.php' === $pagenow ) {
return;
}
$front_id = get_option( 'page_on_front' );
$posts_id = get_option( 'page_for_posts' );
@k4zuki02h4t4
k4zuki02h4t4 / .php
Last active May 10, 2024 16:35
MW WP Form に chatwork ID 用のバリデーションルールを追加する
<?php
/**
* Validation rule chatwork.
*
* @param array $validation_rules
*/
function mwform_validation_rule_chatwork( $validation_rules ) {
if ( ! class_exists("MW_Validation_Rule_Chatwork") ) {
class MW_Validation_Rule_Chatwork extends MW_WP_Form_Abstract_Validation_Rule {
/**
$ cd Users/YOURNAME/Library/Application\ Support/Local\ by\ Flywheel/router/certs
$ mv ./* ../
$ openssl req -new -newkey rsa:2048 -sha256 -nodes \
@k4zuki02h4t4
k4zuki02h4t4 / .txt
Created April 26, 2017 15:40
日数 = 秒
365日 = 31536000
182.5日 = 15768000
180日 = 15552000
90日 = 7776000
30日 = 2592000
15日 = 1296000
7日 = 604800
1日 = 86400
12時間 = 43200
6時間 = 21600