Skip to content

Instantly share code, notes, and snippets.

View akiya64's full-sized avatar
🏠
Working from home

Akiya akiya64

🏠
Working from home
View GitHub Profile
@akiya64
akiya64 / redirect.js
Created October 24, 2023 11:11
Redirect from Gutenberg Block editor
let hasRedirectSet
wp.data.subscribe(()=>{
const { isAutosavingPost,
didPostSaveRequestSucceed,
getCurrentPostAttribute } = wp.data.select('core/editor')
if ( !isAutosavingPost()
&& !hasRedirectSet
&& didPostSaveRequestSucceed()
@akiya64
akiya64 / register_post_type_taxonomy.php
Last active May 13, 2023 23:36
Simple URL structure by simple rewrite rule
<?php
function my_post_type() {
register_post_type(
'news',
array(
'public' => true,
'has_archive' => true,
'rewrite' => array(
'with_front' => false,
'slug' => 'my-post-type'
@akiya64
akiya64 / ShowRootHighlightUnderCursor.lua
Created May 6, 2023 12:48
:ShowRootHighlightUnderCursor
vim.api.nvim_create_user_command('ShowRootHighlightUnderCursor', function()
local function findRoot(id, tree)
local transId = vim.fn.synIDtrans(id)
local name = vim.fn.synIDattr(id, 'name')
table.insert(tree, name)
if id == transId then
print(table.concat(tree, ' -> '))
else
findRoot(transId, tree)
@akiya64
akiya64 / check_recent_tweets.py
Last active March 10, 2022 10:36
Handling Twitter follow and list by Tweepy
from api_key import *
import tweepy
import time
from datetime import datetime, timezone, timedelta
# Keep follow in this listed user.
exclude_list = ["Soukou"]
client = tweepy.Client(
bearer_token = BEARER_TOKEN,
@akiya64
akiya64 / docker-compose.yml
Created November 6, 2021 11:32
docker-mirakurun-epgstation Debian11 PX-W3PE5
version: '3.7'
services:
mirakurun:
image: chinachu/mirakurun
cap_add:
- SYS_ADMIN
- SYS_NICE
ports:
- "40772:40772"
- "9229:9229"
@akiya64
akiya64 / .gitlab-ci.yml
Created May 12, 2021 08:23
Backstopjs on GitLab CI and Pages
stages:
- get_reference
- regression_test
- publish
backstopjs_reference:
stage: get_reference
image:
name: backstopjs/backstopjs:latest
entrypoint: [""]
@akiya64
akiya64 / codesniffer-theme-ruleset.xml
Created January 24, 2020 05:35
WordPressテーマ用ルールセット
<?xml version="1.0"?>
<ruleset name="WordPress" namespace="WordPress">
<description>WordPress Coding Standards</description>
<autoload>./PHPCSAliases.php</autoload>
<rule ref="WordPress-Core">
<exclude name="WordPress.Files.FileName"/>
</rule>
<rule ref="WordPress-Docs"/>
@akiya64
akiya64 / docker_compose.yml
Last active July 3, 2019 03:07
Redmine on QNAP TS231-P
version: '3'
services:
redmine:
image: redmine
restart: always
ports:
- 32790:3000
@akiya64
akiya64 / tuners.yml
Created June 18, 2019 13:08
setting for mirakurun with PT2 and dvb driver
- name: PT2-T1
types:
- GR
command: /usr/local/bin/recdvb --dev 1 --b25 <channel> - -
isDisabled: false
- name: PT2-T2
types:
- GR
command: /usr/local/bin/recdvb -dev 3 -b25 <channel> - -
@akiya64
akiya64 / FileNameSniff.php
Last active October 26, 2018 08:26
Is it disable `is_theme` ? PhpCodeSniffer for WordPress coding Standard
/*
* Generic check for lowercase hyphenated file names.
*/
if ( $fileName !== $expected && ( false === $this->is_theme || 1 !== preg_match( self::THEME_EXCEPTIONS_REGEX, $fileName ) ) ) {
$this->phpcsFile->addError(
'Filenames should be all lowercase with hyphens as word separators. Expected %s, but found %s.',
0,
'NotHyphenatedLowercase',
array( $expected, $fileName )
);