This file contains 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 | |
/** | |
* ゲンロンSF講座の落選者実作を取得する | |
* | |
* simple_html_dom.phpをダウンロードして、同じフォルダに置いてください。 | |
* https://sourceforge.net/projects/simplehtmldom/files/ | |
* | |
* @example | |
* php list.php http://school.genron.co.jp/works/sf/2016/subjects/definition/ | |
*/ |
This file contains 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
{ | |
"entities": [ | |
{ | |
"name": "村田沙耶香", | |
"type": "PERSON", | |
"metadata": { | |
"wikipedia_url": "http://ja.wikipedia.org/wiki/%E6%9D%91%E7%94%B0%E6%B2%99%E8%80%B6%E9%A6%99" | |
}, | |
"salience": 0, | |
"mentions": [ |
This file contains 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 | |
/** | |
* Regsiter script | |
*/ | |
add_action( 'wp_enqueue_scripts', function() { | |
// Set dependency to wp-api, which has nonce and endpoint root. | |
wp_enqueue_script( 'api-handler', '/path/to/api-handler.js', [ 'jquery', 'wp-adpi' ], '1.0', true ); | |
} ); |
This file contains 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
#! /usr/bin/env bash | |
set -e | |
echo "Compiling $1/$2..." | |
cd ~/Downloads | |
mkdir tmp | |
cd tmp | |
git clone [email protected]:$1/$2.git | |
cd $2 |
This file contains 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 | |
/** | |
* Tokenize string to morphemes. | |
* | |
* @param string $string | |
* @return array | |
*/ | |
function hametuha_punctuate( $string ) { | |
try { |
This file contains 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 | |
// パスを設定。なぜかこれがないと動かず。 | |
putenv('PATH=/home/ec2-user/.nvm/versions/node/v6.11.0/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/aws/bin:/home/ec2-user/.local/bin:/home/ec2-user/bin'); | |
//リリースするブランチの指定 | |
$deploy_ref = 'refs/heads/master'; | |
//logファイルの指定 | |
$log_path = '/var/www/wordpress/wp-content/git.log'; |
This file contains 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 | |
# composer require sunra/php-simple-html-dom-parser | |
require __DIR__ . '/vendor/autoload.php'; | |
// Change file size because fb message archive is very big data. | |
define( 'MAX_FILE_SIZE', 1000000000 ); | |
$dom = Sunra\PhpSimple\HtmlDomParser::file_get_html( 'messages.htm' ); | |
$messages = []; |
This file contains 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
# | |
# Backup WordPress contents. | |
# | |
set -e | |
# Move to WordPress dir | |
cd /var/www/wordpress | |
# Remove if exists. |
This file contains 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 | |
/** | |
* Register shortcode [my-template] | |
* | |
* File based short code. | |
* | |
* @param array $atts Shoutcode attribures. | |
* @param string $string Content wrapped in shortcode. | |
* @return string Rendered result. | |
*/ |
This file contains 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 | |
/** | |
* Hide specific media from media library. | |
*/ | |
/** | |
* Case 1. Do not allow gif. | |
* | |
* This filter will be triggered by media library's AJAX action. | |
* |