Skip to content

Instantly share code, notes, and snippets.

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

Yuta Haga yutahaga

🏠
Working from home
View GitHub Profile
// ==UserScript==
// @name Google 検索に 3, 6 ヶ月以内フィルタを追加
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.google.co.jp/search?*
// @grant none
// ==/UserScript==
@yutahaga
yutahaga / setup-context-menu-for-vscode-insiders.ps1
Created January 22, 2018 02:29
scoop でインストールした VS Code Insiders の、カレントユーザーにのみ有効なコンテキストメニューをセットアップ。 ※ BOM付き UTF-8 で保存すること。
$APP_BIN = "$Env:USERPROFILE\\scoop\\apps\\vscode-insiders\\current\\Code - Insiders.exe"
$OPEN_WITH_VS_CODE_PATH = 'hkcu:\Software\classes\*\shell\vscode'
if(!(Test-Path "$OPEN_WITH_VS_CODE_PATH")){
New-Item -Path "$OPEN_WITH_VS_CODE_PATH" -Force
}
New-ItemProperty -Path "$OPEN_WITH_VS_CODE_PATH" -Name '(default)' -PropertyType String -Value 'VS Code で編集'
New-ItemProperty -Path "$OPEN_WITH_VS_CODE_PATH" -Name 'Icon' -PropertyType String -Value "${APP_BIN},0"
if(!(Test-Path "${OPEN_WITH_VS_CODE_PATH}\command")){
New-Item -Path "${OPEN_WITH_VS_CODE_PATH}\command" -Force
#!/bin/bash
#
# [Usage]
# ./migrate-ssl.sh targets.txt
#
# [Example of targets.txt]
#
# hoge.com/public_html/wp
#!/bin/bash
shopt -s expand_aliases
alias wp='/opt/php-7.1.2/bin/php ~/bin/wp-cli.phar'
alias php='/opt/php-7.1.2/bin/php'
option_name=$1
option_key=$2
option_value=$3
wp_path=$4
@yutahaga
yutahaga / migrate-ssl-on-xserver.sh
Created January 18, 2018 19:31
エックスサーバー上の WordPress に自動で SSL 化プラグイン導入、URLオプション更新。
#!/bin/bash
#
# [Usage]
# ./migrate-ssl.sh targets.txt
#
# [Example of targets.txt]
#
# hoge.com/public_html/wp
# foo.bar.jp/public_html
@yutahaga
yutahaga / install-wp-cli-on-xserver.sh
Created January 18, 2018 19:28
エックスサーバーに wp-cli を導入するシェルスクリプト。PHP のバージョンは要確認。
#!/bin/bash
mkdir bin
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
mv wp-cli.phar bin/
echo -e "\nalias wp='/opt/php-7.1.2/bin/php ~/bin/wp-cli.phar'" >> ~/.bashrc
source ~/.bashrc
@yutahaga
yutahaga / .php_cs
Last active January 15, 2018 04:05
My coding standard
<?php
$rules = [
'@PSR2' => true,
'array_syntax' => [
'syntax' => 'short',
],
'binary_operator_spaces' => [
'align_double_arrow' => true,
'align_equals' => null,
@yutahaga
yutahaga / jp-sans.scss
Created January 3, 2018 08:56
日本語ゴシックフォントを良い感じにするスニペット
@font-face {
font-family: JpSans;
font-style: normal;
font-weight: 400;
font-display: swap;
src: local("Hiragino Kaku Gothic ProN"), local("Noto Sans CJK JP Regular"), local("NotoSansCJKJP-Regular"), local("Noto Sans JP Regular"), local("NotoSansJP-Regular"), local("Yu Gothic Medium"), url(//fonts.gstatic.com/ea/notosansjapanese/v6/NotoSansJP-Regular.woff2) format('woff2'), url(//fonts.gstatic.com/ea/notosansjapanese/v6/NotoSansJP-Regular.woff) format('woff'), url(//fonts.gstatic.com/ea/notosansjapanese/v6/NotoSansJP-Regular.otf) format('opentype');
}
@font-face {
font-family: JpSans;
@yutahaga
yutahaga / wp-config.php
Last active December 28, 2017 07:43
ローカル用
<?php
/**
* WordPress の基本設定
*
* このファイルは、インストール時に wp-config.php 作成ウィザードが利用します。
* ウィザードを介さずにこのファイルを "wp-config.php" という名前でコピーして
* 直接編集して値を入力してもかまいません。
*
* このファイルは、以下の設定を含みます。
*
@yutahaga
yutahaga / wp-config.php
Last active November 1, 2017 16:56
APP_ENV で本番・開発環境の設定切り替えするための WordPress 設定ファイル
<?php
/**
* WordPress の基本設定
*
* このファイルは、インストール時に wp-config.php 作成ウィザードが利用します。
* ウィザードを介さずにこのファイルを "wp-config.php" という名前でコピーして
* 直接編集して値を入力してもかまいません。
*
* このファイルは、以下の設定を含みます。
*