Skip to content

Instantly share code, notes, and snippets.

View tekapo's full-sized avatar

Tai / JOTAKI Taisuke tekapo

View GitHub Profile
@tetsuharu-kono
tetsuharu-kono / wifi_site_survey.sh
Last active January 30, 2023 00:14
Wi-Fi site survey script for macOS
#!/bin/zsh
# Wi-Fi Site Survey
# 2020.07.22 Rev. 0.1
# First release
# 2023.01.30 Rev. 0.2
# Fixed channel and BSSID not being retrieved by Monterey
# Fail on unset variables and command errors
set -ue -o pipefail
@hughc
hughc / gutenberg-audit.php
Created April 20, 2020 10:36
Gutenberg Audit for WordPress
<?php
/*
Plugin Name: Gutenberg Audit
Plugin URI: http://highbrow.com.au/plugins/gutenberg-audit
description: What blocks is your site using?
Version: 0.1
Author: Hugh Campbell
Author URI: http://highbrow.com.au/
License: GPL2
*/
@torounit
torounit / useMeta.js
Last active September 1, 2020 03:28
useState 風味に WordPressのカスタムフィールドを扱うやつ
import { Fragment, useCallback } from '@wordpress/element';
import { useDispatch, useSelect } from '@wordpress/data';
const useMeta = ( key ) => {
const meta = useSelect( ( select ) => {
const { getEditedPostAttribute } = select( 'core/editor' );
const values = getEditedPostAttribute( 'meta' ) || {};
return values[ key ] || '';
}, [] );
@skorasaurus
skorasaurus / example1.md
Last active November 11, 2023 17:19
Manage WordPress via WP-CLI with these Shortcuts/scripts/functions/aliases.

update text inside a post (we work with 3rd party vendors, their urls occasionally change; or we changed a campaign's name used in google analytics) and limit it to ONLY published posts. (sometimes, our marketing team wants to what see how content was EXACTLY in the past). wp-cli's search-replace command by default make edits in revisions.

(in this command, 'before' is what you want to get rid of and 'after' is what you want to replace 'before' with.

wp db query "UPDATE $(wp db tables "*_posts") SET post_content = REPLACE(post_content, 'before', 'after') WHERE post_status = 'publish';"

@salcode
salcode / .editorconfig
Last active October 15, 2022 21:22
WordPress .editorconfig - modified version of the WordPress coding standards
# EditorConfig helps keep your project formatting consistent.
# See https://EditorConfig.org
#
# This is a modified version of the WordPress coding standards.
#
# Author: Sal Ferrarello (@salcode)
# https://salferrarello.com/wordpress-editorconfig/
#
# You can download this file directly
# to your project from the command-line with
@miya0001
miya0001 / hatamoto.php
Last active May 21, 2019 05:28
汎用的な管理画面付きのWordPressプラグインのテンプレート
<?php
/**
* Plugin Name: Hatamoto
* Plugin URI: https://wpist.me/
* Description: This is a awesome cool plugin.
* Version: 0.1.0
* Author: Takayuki Miyauchi
* Author URI: https://wpist.me/
* License: GPLv2
* Text Domain: hatamoto
<?php
/*
Plugin Name: must use functions.
Plugin URI:
Description:
Version: 0.1
Author: DigitalCube
Author URI:
License: GPLv2 or later
*/
export PS1="[\u@\h \W]\\$ "
HISTIGNORE=rm\ *
alias vi="vim"
alias delmacfile="find . -name \".DS_Store\" -exec rm -f {} \;"
alias ql='qlmanage -p "$@" >& /dev/null'
alias svndel="svn st | grep '^!' | sed -e 's/\![ ]*/svn del /g' | sh"
alias svnadd="svn st | grep '^?' | sed -e 's/\?[ ]*/svn add /g' | sh"
alias yuicomp="/usr/local/bin/yuicompressor --charset UTF-8 -o"
@wokamoto
wokamoto / gist:5994354
Created July 14, 2013 13:53
White Ale Coriander Special PHAK CHEE MASHI2
モルト
2-ROW 10,400g
WHEAT MALT 3,900g
ホップ
1st
チヌーク 15g
3rd
ストリアンゴールディング 30g
カスケード 25g
@gatespace
gatespace / view_template_files.php
Last active July 30, 2022 22:04
WordPressのテーマにおいて、テンプレート階層に基づきどのテンプレートファイルが使われているか書き出すコード。 WordPressがデバッグモードのときのみ表示します。 使っているテンプレートファイルはグローバル変数 $template に保存されています。 (ただし、header.php や get_template_part などでインクルードされているファイルを除く) wp_footerにフックする形で関数が実行されますので、テーマのfunctions.phpの適当な箇所に追記してください。
/*
WordPressのテーマにおいて、テンプレート階層に基づきどのテンプレートファイルが使われているか書き出すコード。
ただし、header.php や get_template_part などでインクルードされているファイルを除く。
*/
add_action('wp_footer', 'view_template_files');
if ( !function_exists( 'view_template_files' ) ):
function view_template_files() {
if ( defined('WP_DEBUG') && WP_DEBUG ) {
global $template;