This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * すべての PHP プロセスの前に whoops を呼び出す | |
| * | |
| * php.ini 内で次のようにセットされています | |
| * auto_prepend_file = "/path/to/set_whoops.php" | |
| * | |
| * セットアップ手順: | |
| * 1. whoops をインストール `$ composer global require 'filp/whoops'` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * ふたつの数値からなる配列の各要素を足しあわせた配列を返す | |
| * | |
| * array_map() を使いたいが長さが違う場合の挙動などが不明なので for ループで計算しています。 | |
| * | |
| * @param float[] $a1 | |
| * 数値の配列。長さは $a2 と共通。 | |
| * @param float[] $a2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| coding: utf-8 | |
| """ | |
| Drupal サイトでユーザを登録するためのスクリプト | |
| 必要なもの | |
| - selenium: `pip install selenium` | |
| """ | |
| import sys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1|北海道 | |
| 2|青森県 | |
| 3|岩手県 | |
| 4|宮城県 | |
| 5|秋田県 | |
| 6|山形県 | |
| 7|福島県 | |
| 8|茨城県 | |
| 9|栃木県 | |
| 10|群馬県 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // なるべくホワイトスクリーンを避けてエラーを画面に表示するようにする | |
| // - 開発環境のみで使用すること | |
| // - 上 3 行は Drupal にかぎらず PHP 一般に有効 | |
| // @see https://www.drupal.org/node/1056468 | |
| error_reporting(-1); | |
| ini_set('display_errors', TRUE); | |
| ini_set('display_startup_errors', TRUE); | |
| $conf['error_level'] = 2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Drupal 7 でワンクリックで投稿画面を開くブックマークレット | |
| * | |
| * Prepopulate モジュールが有効になっている必要があります | |
| */ | |
| javascript: (function(){ | |
| 'use strict'; | |
| var BASE_URL, | |
| NODE_TYPE, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * 指定された範囲のボキャブラリーをまとめて削除する | |
| * | |
| * 例: my_func_delete_vocabularies(23, 35); | |
| * vid が 23 から 35 まで( 35 を含む)のボキャブラリーを全件削除する。 | |
| * | |
| * @param int $index_start |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * node の body のフォーマットをカウントする | |
| * | |
| * 対象はあくまでも body だけなので他のフィールドでの使用有無はわからないため要注意 | |
| * | |
| * 出力サンプル: | |
| * array( | |
| * 'full_html' => 21, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Implements template_preprocess_table(). | |
| */ | |
| function mytheme_preprocess_table(&$variables) { | |
| // すべてのテーブルでテーブルの sticky header を止める | |
| $variables['sticky'] = FALSE; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # coding: utf-8 | |
| """ | |
| WordPress のプラグインリスト(プラグイン)の情報をまとめて取得する | |
| usage: | |
| $ python __file__ | |
| """ |