Skip to content

Instantly share code, notes, and snippets.

View hyuki's full-sized avatar

Hiroshi Yuki / 結城浩 hyuki

View GitHub Profile
@hyuki
hyuki / index.html
Created December 9, 2018 13:53
drawicon - drawing 8x8 identicon-like icon with SVGjs.
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="結城浩 / Hiroshi Yuki">
<meta name="keywords" content="結城浩,Hiroshi Yuki" >
<title>drawicon</title>
@hyuki
hyuki / ShowMobileTweet.js
Last active January 15, 2019 02:57
ShowMobileTweet.js - Bookmarklet to jump from twitter.com to mobile.twitter.com.
/*
* ShowMobileTweet.js
*
* When you see:
* https://twitter.com/hyuki/status/1079981317184315392
* Then jump to:
* https://mobile.twitter.com/hyuki/status/1079981317184315392
*/
function start() {
@hyuki
hyuki / README.md
Last active January 17, 2019 15:53
update-shelf.rb - Extract first jpeg file from pdf files.

convert(ImageMagick) is required.

$ vi update-shelf     (Edit PDFDIR and SHELFDIR)
$ update-shelf
$ erb shelf.erb > index.html
$ open -a safari index.html
@hyuki
hyuki / makeapp.rb
Created January 31, 2019 16:55 — forked from hyuki0000/makeapp.rb
makeapp - スクリプトをMacのアプリケーションにする
#!/usr/bin/env ruby
# cf. http://bit.ly/2raKfLZ
# makeapp - スクリプトをMacのアプリケーションにする
if ARGV.length != 2
abort("Usage: makeapp foo.rb Foo.app")
end
scriptname = ARGV[0]
appname = ARGV[1]
@hyuki
hyuki / makeopenapp.rb
Created January 31, 2019 16:43 — forked from hyuki0000/makeopenapp.rb
URLをオープンするだけのアプリを作るスクリプト
#!/usr/bin/env ruby
# cf. http://bit.ly/2raKfLZ
# makeopenapp - URLをオープンするだけのスクリプトをMacのアプリケーションにする
if ARGV.length != 2
abort("Usage: makeopenapp URL Example.app")
end
url = ARGV[0]
appname = ARGV[1]
@hyuki
hyuki / README.md
Last active February 8, 2019 02:32
Barebone Bootstrap4 - A Simple Bootstrap4 Template using erb.

What's this?

Barebone Bootstrap4 - A Simple Bootstrap4 Template using erb.

Requirements

  • Embedded Ruby (ERB).

How to use

@hyuki
hyuki / README.md
Last active March 5, 2019 12:39
compare_escape.rb - Compare CGI.escapeHTML, CGI.escape, and URI.encode.
CGI.escapeHTML('< > &') #=> &lt; &gt; &amp;
CGI.escape('< > &')     #=> %3C+%3E+%26
URI.encode('< > &')     #=> %3C%20%3E%20&

CGI.escapeHTML('https://example.com/')  #=> https://example.com/
CGI.escape('https://example.com/')      #=> https%3A%2F%2Fexample.com%2F
URI.encode('https://example.com/')      #=> https://example.com/

CGI.escapeHTML('結') #=&gt; 結

見出し

  • 一つ
  • 二つ
  • 三つ
@hyuki
hyuki / stairs.rb
Created May 31, 2019 01:01
stairs.rb - 階段昇降
# 毎日『m段上ってn段下がる』を繰り返したら、
# x日目にd段目に初めて着いた。
# xをd,m,nで表せ。文字はすべて正の整数で、m>nとする。#数学の問題
# https://twitter.com/hyuki/status/1134018952416321536
# current段目から「m段上ってn段下がる」ときに通過する
# 「段目」を引数にブロックをyieldして
# 最終的な段目を戻り値に
def daily(current,m,n)
m.times do
@hyuki
hyuki / stairs.rb
Last active May 31, 2019 01:04
stairs.rb - 階段昇降
# 毎日『m段上ってn段下がる』を繰り返したら、
# x日目にd段目に初めて着いた。
# xをd,m,nで表せ。文字はすべて正の整数で、m>nとする。#数学の問題
# https://twitter.com/hyuki/status/1134018952416321536
# current段目から「m段上ってn段下がる」ときに通過する
# 「段目」を引数にブロックをyieldして
# 最終的な段目を戻り値に
def daily(current,m,n)
m.times do