Skip to content

Instantly share code, notes, and snippets.

Avatar

yokota kenji yokotak0527

View GitHub Profile
@yokotak0527
yokotak0527 / change_image_insert_code.php
Last active Nov 4, 2019
WordPresの画像をエディタに追加する際 HTML ではなく Markdown にする。
View change_image_insert_code.php
<?php
function change_image_insert_code($html){
$rootURL = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://').$_SERVER['HTTP_HOST'];
preg_match('/src="([a-z\d:\/.\-\_%~^]+)/i', $html, $src);
$src = str_replace($rootURL, '', $src[1]);
// error_log($html, 3, '/var/www/html/dump.log');
preg_match('/alt="([^"]+)"/', $html, $alt);
$alt = empty($alt[1]) ? '' : $alt[1];
@yokotak0527
yokotak0527 / raedme.md
Last active Sep 27, 2019
DockerでWordPressをサクッと立ち上げ
View raedme.md

立ち上げ

$ docker run -d --name temp_wp_db -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=wp mysql:5.7 && docker run -d --name temp_wp --link temp_wp_db:db -p 80:80 -e WORDPRESS_DB_PASSWORD=root -e WORDPRESS_DB_HOST=db -e WORDPRESS_DB_NAME=wp wordpress:latest

削除

$ docker rm -f temp_wp_db temp_wp
@yokotak0527
yokotak0527 / webpack.config.js
Last active Sep 20, 2019
webpack splitchunk 例
View webpack.config.js
optimization : {
splitChunks : {
name : false,
cacheGroups : {
default : false,
vendors : {
test : /node_modules/,
chunks (chunk) {
return chunk.name !== 'js/preload'
},
@yokotak0527
yokotak0527 / async2sync.js
Last active Aug 28, 2019
並列処理を直列処理にする案
View async2sync.js
function async1 () {
return new Promise(resolve => {
setTimeout(() => {
resolve('async1 done')
}, 3000)
})
}
function async2 () {
return new Promise(resolve => {
setTimeout(() => {
@yokotak0527
yokotak0527 / getfile.js
Created Aug 23, 2019
globでファイル一覧取得
View getfile.js
// node_modulesを除くjsファイル
glob.sync('{,!(node_modules)/**/}[!_]*.js')
// node_modulesを除くSassファイル (.sassと.scss)
glob.sync('{,!(node_modules)/**/}[!_]*.s[a|c]ss')
View blog-6506-components.pu
@startuml kubernetes components
skinparam monochrome true
skinparam shadowing false
skinparam linetype ortho
skinparam defaultFontName Cica
skinparam noteBackgroundColor white
rectangle kubectl
rectangle "Kubernetes Cluster" {
@yokotak0527
yokotak0527 / v-input.vue
Last active May 26, 2019
inputタグのradio,checkbox,text(etc.), submit,buttonをまとめたvueテンプレート
View v-input.vue
<template>
<div>
<v-radio v-if="type === 'radio'" />
<v-checkbox v-else-if="type === 'checkbox'" />
<v-button v-else-if="type === 'button' || type === 'submit'" />
<v-text v-else />
</div>
</template>
<script>
View keybase.md

Keybase proof

I hereby claim:

  • I am yokotak0527 on github.
  • I am yokotak0527 (https://keybase.io/yokotak0527) on keybase.
  • I have a public key ASBh0EFyiK1je-2pFf6BsucJLr2rOUl9Rw4LfEneZyHd3go

To claim this, I am signing this object:

@yokotak0527
yokotak0527 / async_series_with_generator.js
Created Feb 12, 2019
ジェネレータ関数を使った直接非同期通信
View async_series_with_generator.js
// ジェネレータ関数
const gfn = function * (start, end) {
while(start <= end) {
yield [expect Promise code]
start++
}
}
const g = gfn(1, 10)
@yokotak0527
yokotak0527 / Excel_cell_pointer.php
Last active May 23, 2018
Excelのラベルを参照するクラス
View Excel_cell_pointer.php
<?php
class Excel_cell_pointer {
private $map = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Z'];
/**
*
* @param string $col_label // 列
* @param integer $row_label // 行
*/
public function __construct($col_label = 'A', $row_label = 1){
You can’t perform that action at this time.