Skip to content

Instantly share code, notes, and snippets.

View ryo-utsunomiya's full-sized avatar

Ryo Utsunomiya ryo-utsunomiya

View GitHub Profile
@ryo-utsunomiya
ryo-utsunomiya / highlight-bookmarklet.js
Created November 26, 2018 16:00
Browser bookmarklet to apply JavaScript syntax highlight with current page.
javascript:(l=>{let e=l.createElement("link");e.rel="stylesheet",e.href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/styles/github.min.css",l.body.appendChild(e),(e=l.createElement("script")).src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/highlight.min.js",e.onload=(()=>{(e=document.createElement("script")).src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/languages/javascript.min.js",e.onload=(()=>{l.querySelectorAll("pre").forEach(hljs.highlightBlock)}),l.body.appendChild(e)}),l.body.appendChild(e)})(document);
@ryo-utsunomiya
ryo-utsunomiya / highlight.js
Last active December 25, 2018 12:09
A simple code snippet to apply syntax highlight with current page
(d => {
let e = d.createElement('link');
e.rel = 'stylesheet';
e.href = 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/styles/github.min.css';
d.body.appendChild(e);
e = d.createElement('script');
e.src = 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/highlight.min.js';
e.onload = () => {
e = document.createElement('script');
@ryo-utsunomiya
ryo-utsunomiya / gutenberg.xml
Created December 23, 2017 12:27
PhpStorm setting for Gutenberg Development
<code_scheme name="Gutenberg" version="173">
<HTMLCodeStyleSettings>
<option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
</HTMLCodeStyleSettings>
<JSCodeStyleSettings>
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
<option name="SPACES_WITHIN_IMPORTS" value="true" />
<option name="SPACES_WITHIN_INTERPOLATION_EXPRESSIONS" value="true" />
</JSCodeStyleSettings>
<PHPCodeStyleSettings>
@ryo-utsunomiya
ryo-utsunomiya / file0.js
Last active November 18, 2019 06:27
Object.definePropertyによるVue.jsのリアクティビティを紐解く ref: https://qiita.com/ryo511/items/b3e639be256d17e31422
const vm = new Vue({
el: '#app',
data: {
message: 'Hello, World',
}
});
// ここではvm.messageはリアクティブ
vm.message = 'Hello, Vue.js!';
@ryo-utsunomiya
ryo-utsunomiya / gpg_verify.php
Last active March 24, 2017 04:26
Verify an email with PGP/MIME signature
#!/usr/bin/env php
<?php
/**
* gpg_verify.php
*
* This script requires PHP 5.5+.
*
* @author Ryo Utsunomiya
* @license MIT
@ryo-utsunomiya
ryo-utsunomiya / file0.txt
Last active January 13, 2017 16:36
[PHP] mb_decode_mimeheader() は Quoted-printable なヘッダのデコードに失敗する ref: http://qiita.com/ryo511/items/82022f836f0fe033020b
=?utf-8?Q?=E3=83=86=E3=82=B9=E3=83=88This_is_valid_subject_of_MIM?=
=?utf-8?Q?E_header?=
require 'minitest/autorun'
def fizzbuzz(n)
return 'FizzBuzz' if n % 15 == 0
return 'Buzz' if n % 5 == 0
return 'Fizz' if n % 3 == 0
n
end
class TestFizzBuzz < Minitest::Test
#!/usr/bin/env php
<?php
//
// todoist_template_editor.php
//
// Usage: $ php todoist_template_editor.php 'do something' 10
// => output todoist template 'do something.csv'.
if (!isset($argv[1])) {
var voice = WScript.CreateObject("SAPI.SpVoice");
voice.Speak("3");
WScript.Sleep(1 * 1000);
voice.Speak("2");
WScript.Sleep(1 * 1000);
voice.Speak("1");
WScript.Sleep(1 * 1000);
voice.Speak("START");
WScript.Sleep(1 * 1000);
voice.Speak("OWARI DESU");
#!/usr/bin/env ruby
def say(str)
system 'say ' + str
end
presentationTime = 300
discussionTime = 60
say '3'