Skip to content

Instantly share code, notes, and snippets.

Takayuki Miyauchi miya0001

View GitHub Profile
View install-node.sh
#!/usr/bin/env bash
set -ex
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo ln -s /usr/bin/nodejs /usr/local/bin/node
@miya0001
miya0001 / tello.js
Last active Dec 21, 2018
tello 編隊飛行
View tello.js
#!/usr/bin/env node
'use strict'
const PORT = 8889;
const HOST = [
'192.168.43.208',
'192.168.43.19'
];
@miya0001
miya0001 / tello.js
Last active Jan 30, 2019
Tello + Node.js example
View tello.js
#!/usr/bin/env node
'use strict'
const PORT = 8889;
const HOST = '192.168.10.1';
const dgram = require('dgram');
const client = dgram.createSocket('udp4');
@miya0001
miya0001 / screenshot.js
Last active Aug 12, 2018
スクリーンショットをとる
View screenshot.js
const puppeteer = require('puppeteer');
async function sleep(delay) {
return new Promise(resolve => setTimeout(resolve, delay));
}
(async () => {
const browser = await puppeteer.launch({
disable-gpu: true,
args: ['--no-sandbox']
@miya0001
miya0001 / ja.md
Last active Jun 25, 2018
Next generation of multibyte fix for WordPress
View ja.md

The length of the excerpt should be localizable.

We can make it localizable by adding number of the length into .po like following.

msgctxt "excerpt length"
msgid "40"

The length of the comment in dashboard should be localizable.

@miya0001
miya0001 / example.md
Created Jun 24, 2018
Jekyll Markdown Example
View example.md
layout title date categories
post
Welcome to Jekyll!
2015-11-17 16:16:01 -0600
jekyll update

You’ll find this post in your _posts directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run bundle exec jekyll serve, which launches a web server and auto-regenerates your site when a file is updated.

To add new posts, simply add a file in the _posts directory that follows the convention YYYY-MM-DD-name-of-post.ext and includes the necessary front matter. Take a look at the source for this post to get an idea about how it works.

View gist:ccd63d44ba89e74fa7e8e88cfea92937

目的

持続性がある方法を目指す。

  • インフラコストがかからないこと。
  • 特定の誰かに権限が集中しないこと。
  • すべてが公開された場所に残ること。(たとえば閲覧する際に認証とが必要ないこと。パーマリンクがあって後から参照しやすいこと。)
  • オープンソースコミュニティっぽい方法であること。「オープンソースっぽい」は毎日進化してます。
@miya0001
miya0001 / file0.txt
Last active Apr 5, 2018
PHPUnitでHTMLをDOMでパースしてテスト ref: https://qiita.com/miya0001/items/178f31035f63bba63f67
View file0.txt
$ composer require symfony/dom-crawler symfony/css-selector --dev
@miya0001
miya0001 / install-php56-to-vccw.sh
Last active Mar 21, 2018
Install PHP 5.6 into the VCCW
View install-php56-to-vccw.sh
#!/usr/bin/env bash
set -ex
PHP_VERSION=${1-"7.0"}
sudo apt update -y
sudo apt install \
php${PHP_VERSION} \
@miya0001
miya0001 / jpegoptim.php
Created Mar 20, 2018
Optimizing images for WordPress with the jpegoptim
View jpegoptim.php
<?php
add_filter( 'wp_image_editors', function( $editors ) {
if ( ! class_exists( '_WP_Image_Editor_GD' ) ) {
class _WP_Image_Editor_GD extends WP_Image_Editor_GD {
protected function _save( $image, $filename = null, $mime_type = null ) {
$saved = parent::_save( $image, $filename, $mime_type );
if ( ! empty( $saved["mime-type"] ) && 'image/jpeg' == $saved["mime-type"] ) {
jpegoptim( $saved['path'] );
}
You can’t perform that action at this time.