Skip to content

Instantly share code, notes, and snippets.

@lunaluna
lunaluna / Brewfile
Last active November 7, 2023 12:48
Brewfile
View Brewfile
tap "1password/tap"
tap "felixkratz/formulae"
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-fonts"
tap "homebrew/cask-versions"
tap "homebrew/core"
tap "homebrew/services"
tap "shivammathur/php"
@lunaluna
lunaluna / functions.php
Created August 12, 2023 12:14
【WordPress】WordPress のサイトを Git 管理している状態で「サイトはバージョン管理されているようです。自動更新は無効化されています。」の表示が出ている場合でもコアの自動アップデートに対応するフック
View functions.php
<?php
add_filter( 'automatic_updates_is_vcs_checkout', '__return_false', 1 );
@lunaluna
lunaluna / zip_command.md
Last active August 9, 2023 07:04
zipコマンドでディレクトリをzip化
View zip_command.md
  1. zipコマンドでディレクトリをzip化
$ zip -r {directory_name}.zip {directory_name}
  1. unzip
$ unzip {zip_name}.zip
@lunaluna
lunaluna / git-rm.sh
Created May 31, 2023 08:38
【Git】削除したファイルだけaddする方法
View git-rm.sh
```
$ git rm $(git ls-files --deleted)
```
@lunaluna
lunaluna / local-sql-command.md
Created February 7, 2023 14:45
Local(ex. Local by flywheel)のデータベースに sql ファイルを直接インポートしたいとき
View local-sql-command.md
% mysql -uroot -proot -hlocalhost -S/Users/********/Library/Application\ Support/Local/run/*********/mysql/mysqld.sock local < local.sql
@lunaluna
lunaluna / gist:85bd77b3476d14002334d3ea31a10aae
Last active September 8, 2022 05:06
【WordPress】アイキャッチ画像URLの取得【WP4.4〜】
View gist:85bd77b3476d14002334d3ea31a10aae

アイキャッチ画像のURLを取得する関数

get_the_post_thumbnail_url( get_the_ID(), $size );

アイキャッチ画像のURLを出力する関数

the_post_thumbnail_url
@lunaluna
lunaluna / archive_url_title.php
Last active June 3, 2021 09:54
【WordPress】テンプレートのURL(とタイトル)を(だいたい)一発で取得するタグ
View archive_url_title.php
// カスタム投稿タイプのアーカイブ一覧ページ
$archive_url = get_post_type_archive_link( $post_type );
$archive_slug = get_post_type( $post );
$storeblog_obj = get_post_type_object( $archive_slug );
$archive_title = $storeblog_obj -> label;
@lunaluna
lunaluna / example-dashboard-video-widget-function.php
Last active February 5, 2021 03:33
【WordPress】ダッシュボードウィジェットに動画を埋め込んだウィジェットを追加する
View example-dashboard-video-widget-function.php
function example_dashboard_video_widget_function() {
ob_start();
?>
<div class="example-dashboard-video">
<iframe width="560" height="315" src="https://www.youtube.com/embed/◯◯◯◯◯◯◯" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
<p>もっと詳しい操作方法は<a href="" target="blank" rel="noopener noreferrer">こちらのリンク先の解説</a>をご覧ください。</p>
<style>
.example-dashboard-video {
position: relative; // 外枠に設定
@lunaluna
lunaluna / move-mobilesync.sh
Created December 11, 2020 02:25
iPhoneのバックアップデータをMac本体から外部SSDに変更する
View move-mobilesync.sh
# 本来のバックアップファイルの所在 '/Users/{{ユーザー名}}/Library/Application Support/MobileSync'
# 移動先 '/Volumes/{{外部SSD名}}/iphone-bk/Backup'
$ ln -s "/Volumes/{{外部SSD名}}/iphone-bk/Backup" "/Users/{{ユーザー名}}/Library/Application Support/MobileSync"
@lunaluna
lunaluna / no-pid-file.md
Last active June 23, 2020 08:22
【ERROR】ERROR! MySQL server PID file could not be found!
View no-pid-file.md

1.既にprocessが重複して動いていないか確認

  1. mysqlのプロセスを確認
$ ps ax | grep mysql
  1. いくつも出てくるプロセスIDを停止する
$ sudo kill -TERM 4xxxx