<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.9.0">Jekyll</generator><link href="http://poem.mzyy94.com/atom.xml" rel="self" type="application/atom+xml" /><link href="http://poem.mzyy94.com/" rel="alternate" type="text/html" /><updated>2021-06-25T20:46:40+00:00</updated><id>http://poem.mzyy94.com/atom.xml</id><title type="html">Poem</title><subtitle>ポエム</subtitle><author><name>mzyy94</name></author><entry><title type="html">界隈のレベルを下げるエンジニアの特徴</title><link href="http://poem.mzyy94.com/items/fxxkn-enginewe" rel="alternate" type="text/html" title="界隈のレベルを下げるエンジニアの特徴" /><published>2018-02-12T07:20:12+00:00</published><updated>2018-02-12T07:20:12+00:00</updated><id>http://poem.mzyy94.com/items/fxxkn-enginewe</id><content type="html" xml:base="http://poem.mzyy94.com/items/fxxkn-enginewe">&lt;p&gt;辟易してる&lt;/p&gt;

&lt;h2 id=&quot;名称を正確に書けない&quot;&gt;名称を正確に書けない&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;XCode&lt;/li&gt;
  &lt;li&gt;Github&lt;/li&gt;
  &lt;li&gt;Javascript&lt;/li&gt;
  &lt;li&gt;Ocaml&lt;/li&gt;
  &lt;li&gt;OpenSUSE&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;スライドが汚い&quot;&gt;スライドが汚い&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;文字詰めすぎ&lt;/li&gt;
  &lt;li&gt;色味なさすぎ&lt;/li&gt;
  &lt;li&gt;デザインにこだわりがなさすぎる&lt;/li&gt;
  &lt;li&gt;人に見せるなら見やすい資料を作れ&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;リポジトリが汚い&quot;&gt;リポジトリが汚い&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;バイナリファイル置き場として使ってる&lt;/li&gt;
  &lt;li&gt;ライセンスがない&lt;/li&gt;
  &lt;li&gt;.DS_Storeとかthumbs.dbとかpushしちゃう&lt;/li&gt;
  &lt;li&gt;READMEに内容がない&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;アウトプットがクズ&quot;&gt;アウトプットがクズ&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;誰でも知ってることをQiitaとかに書いちゃう&lt;/li&gt;
  &lt;li&gt;ドキュメントをろくに読まずに記事書いちゃう&lt;/li&gt;
  &lt;li&gt;仕様を確認してから意見しろ&lt;/li&gt;
  &lt;li&gt;動かないコードを記事に書いちゃう&lt;/li&gt;
  &lt;li&gt;WordPressとか使っててエスケープされてたりするのに気づかず動かないコードをそのまま載せちゃう&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;情報収集が雑&quot;&gt;情報収集が雑&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;一次ソースを特定できない情報を鵜呑みにしちゃう/拡散しちゃう&lt;/li&gt;
  &lt;li&gt;ブラック企業は嫌いなくせに権利関係がブラックなコンテンツは拡散しちゃう&lt;/li&gt;
  &lt;li&gt;パクツイをRTする程度のリテラシーの低さを晒す自己紹介いつもご苦労様です&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;守るものは守れ&quot;&gt;守るものは守れ&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;法律を守れ&lt;/li&gt;
  &lt;li&gt;条例を守れ&lt;/li&gt;
  &lt;li&gt;権利を侵害するな&lt;/li&gt;
  &lt;li&gt;労基法を守れサービス残業するなブラック企業の養分になるな潰せ&lt;/li&gt;
&lt;/ul&gt;</content><author><name>mzyy94</name></author><category term="engineer" /><category term="bug" /><summary type="html">辟易してる</summary></entry><entry><title type="html">プログラミングに限定しない知識でも記録・共有したくなるようなブログテーマを作った</title><link href="http://poem.mzyy94.com/items/kieta-blog-theme" rel="alternate" type="text/html" title="プログラミングに限定しない知識でも記録・共有したくなるようなブログテーマを作った" /><published>2017-05-13T13:00:00+00:00</published><updated>2017-05-13T13:00:00+00:00</updated><id>http://poem.mzyy94.com/items/kieta-blog-theme</id><content type="html" xml:base="http://poem.mzyy94.com/items/kieta-blog-theme">&lt;p&gt;Markdownで気軽にポエムが書けるサイトがあったような前世の記憶があるのですが、みつからなかったのでGitHub Pagesで色々な知識をひけらかすためのJekyllテーマを作りました。ライセンスはMITです。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://github.com/mzyy94/jekyll-kieta-theme&quot;&gt;mzyy94/jekyll-kieta-theme: Clean knowledge sharing jekyll theme&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;その名もKieta。最初のKはKnowledgeのKということだけ決めていますが、名前の由来は特にありません。&lt;/p&gt;

&lt;p&gt;リポジトリからファイル一式をダウンロードしてきて、Jekyllの作法に従って設定してMarkdownで記事を書くとこのように仕上がります。&lt;/p&gt;

&lt;h1 id=&quot;特徴&quot;&gt;特徴&lt;/h1&gt;

&lt;h2 id=&quot;自由な設計&quot;&gt;自由な設計&lt;/h2&gt;

&lt;p&gt;オープンソースなので好きなようにカスタマイズができます。たとえばサイドバーにAmazonの広告を表示して、みんなに充電池をオススメすることができます。&lt;/p&gt;

&lt;h2 id=&quot;モダンなcssフレームワーク&quot;&gt;モダンなCSSフレームワーク&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/images/preview1.png&quot; alt=&quot;preview 1&quot; /&gt;&lt;/p&gt;

&lt;p&gt;みんな忘れかけていたであろうTwitter Bootstrap 4を採用しています。&lt;br /&gt;
ReactだVueだの騒がれているこのご時世、コンポーネントとしてではなくCSS単体として提供されているBootstrapを使っている人は少ないかと思います。&lt;br /&gt;
俗にいうBootstrap臭がツンと来る人も多く、あまり好まれて使われてこなかったBootstrapですが、基本テーマをフラットデザインに近づける努力を続けています。&lt;br /&gt;
そして間も無くベータ版が登場するTwitter Bootstrap 4では、Flexboxなどの機能を引っさげて大幅な更新を仕掛けて来る予定です。&lt;/p&gt;

&lt;p&gt;そんなTwitter Bootstrap 4を一足先に導入しました。今回は執筆時点の最新版alpha-6を利用しています。&lt;/p&gt;

&lt;h3 id=&quot;基本テーマの調整&quot;&gt;基本テーマの調整&lt;/h3&gt;

&lt;p&gt;Twitter Bootstrapの最も自己主張の強いコンポーネントにJumbotronがあります。このKietaテーマでも強い存在感を放つ記事のタイトル部分にそれを用いています。&lt;br /&gt;
Jumbotronの協調される色は記事の印象も左右するため、Jekyllの設定ファイルにて変更ができるようにしてあります。&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;deepskyblue&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;/images/preview2.png&quot; alt=&quot;preview 2&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;タグ&quot;&gt;タグ&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/images/preview3.png&quot; alt=&quot;preview 3&quot; /&gt;&lt;/p&gt;

&lt;p&gt;記事にはタグがついていますが、それをタグであるとわかりやすく表示するために工夫しました。タグ自体は1つのａタグですが、これを「タグ」っぽく表示させるために擬似要素を用いてデザインしています。ついでにJekyllのsite変数から全投稿の中のタグ利用数を表示してあります。&lt;/p&gt;

&lt;div class=&quot;language-scss highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;.tag&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;lightgrey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;black&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;outline&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;none&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;relative&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;.9rem&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1rem&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;line-height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1rem&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;8px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;inline-block&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;auto&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;20px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;::before&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nl&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nl&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nl&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;absolute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nl&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nl&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;.5rem&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;solid&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;transparent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nl&quot;&gt;border-right-color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;lightgrey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nl&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;-1rem&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nl&quot;&gt;top&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;::after&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nl&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;attr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data-count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;nl&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;inline-block&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nl&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;.5em&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nl&quot;&gt;text-align&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;center&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nl&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;white&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nl&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;darkslategrey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nl&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;absolute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nl&quot;&gt;margin-left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;8px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;追従する目次&quot;&gt;追従する目次&lt;/h2&gt;

&lt;p&gt;技術系記事に限らず、文書の全体のどの位置を読んでいるかが把握できないとモヤモヤするので、常に目次が見れるようにしました。&lt;br /&gt;
この記事をデスクトップPCやタブレットで読んでいる方は、右側に目次が追従してきているのがわかると思います。これは&lt;a href=&quot;https://github.com/tscanlin/tocbot&quot;&gt;tscanlin/tocbot&lt;/a&gt;を利用して実現しています。&lt;/p&gt;

&lt;h2 id=&quot;新鮮なポエムをあなたに&quot;&gt;新鮮なポエムをあなたに&lt;/h2&gt;

&lt;p&gt;古いポエムには警告が表示されるようにしました。Jekyllは素のLiquidとは違って、数値の比較が動かなかったのでがんばりました。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/preview4.png&quot; alt=&quot;preview 4&quot; /&gt;&lt;/p&gt;

&lt;div class=&quot;language-liquid highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{%&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;capture&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;one_year&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;%}{{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;times&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;times&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;24&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;times&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;365&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}}{%&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;endcapture&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;%}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{%&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;capture&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;current_time&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;%}{{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;site&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;%s&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}}{%&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;endcapture&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;%}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{%&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;capture&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;year_old&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;%}{{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;%s&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;minus&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;current_time&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;divided_by&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;one_year&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;plus&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}}{%&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;endcapture&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;%}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{%&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kr&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;year_old&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;ow&quot;&gt;contains&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'-'&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;%}&lt;/span&gt;
&amp;lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&amp;gt;
    &amp;lt;i class=&quot;fa fa-clock-o&quot; aria-hidden=&quot;true&quot;&amp;gt;&amp;lt;/i&amp;gt; This article is more than 1 year old. Please read this page keeping its age in your mind.
&amp;lt;/div&amp;gt;
&lt;span class=&quot;p&quot;&gt;{%&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kr&quot;&gt;endif&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;%}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;数々のシェアボタン&quot;&gt;数々のシェアボタン&lt;/h2&gt;

&lt;p&gt;ポエムはいろいろな人に共有していきたい気持ちが高いと思うので、思いつく限りのシェアボタンを設置しました。&lt;br /&gt;
参考にした公式ドキュメントは以下の通りです。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://about.twitter.com/ja/resources/buttons&quot;&gt;Twitterボタン | About&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://developers.facebook.com/docs/plugins/like-button?locale=ja_JP&quot;&gt;いいね！ボタン - ソーシャルプラグイン&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://b.hatena.ne.jp/guide/bbutton&quot;&gt;はてなブックマークボタンの作成・設置について - はてなブックマーク&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://getpocket.com/publisher/button&quot;&gt;Pocket for Publishers: Pocket Button&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://developers.google.com/+/web/+1button/&quot;&gt;+1 Button  |  Google+ Platform for Web  |  Google Developers&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;コメント機能とコメント数の表示&quot;&gt;コメント機能とコメント数の表示&lt;/h2&gt;

&lt;p&gt;コメント機能はGitHub Pages利用者にはおなじみの&lt;a href=&quot;https://disqus.com/&quot;&gt;Disqus&lt;/a&gt;を利用しています。また、Jumbotronにタイトルとタグだけを表示して置くだけではあっさりしすぎていたので、いっしょにコメント数とツイートボタンを表示しています。&lt;br /&gt;
このコメント数は、DisqusのAPIで取得できるものを整形して出しています。Disqus側で出力を変えられるのですが、ちょっと利用環境の都合でこんな細々とした作業を入れてあります。&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;MutationObserver&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;MutationObserver&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;WebKitMutationObserver&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;MutationObserver&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;obs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;MutationObserver&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;mutations&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;observer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mutation&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mutations&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;count&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mutation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addedNodes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;textContent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;[^&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;0-9&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/g&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;comment_count&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;textContent&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;mutation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;parentNode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;removeChild&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;mutation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;obs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;disconnect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;obs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;observe&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;disqus_comment_count&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;childList&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;subtree&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;characterData&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;404ページ&quot;&gt;404ページ&lt;/h2&gt;

&lt;p&gt;うっかり遭遇すると悲しいページである404 Not Found。悲しさを紛らわすための工夫として、新鮮なポエムが流れるようにしておきました。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/preview5.png&quot; alt=&quot;preview 5&quot; /&gt;&lt;/p&gt;

&lt;h1 id=&quot;まとめ&quot;&gt;まとめ&lt;/h1&gt;

&lt;p&gt;検閲のない自由なインターネットを謳歌しよう。&lt;/p&gt;</content><author><name>mzyy94</name></author><category term="Bootstrap4" /><category term="Kieta" /><category term="技術で歯向かえTOKYO2020" /><summary type="html">Markdownで気軽にポエムが書けるサイトがあったような前世の記憶があるのですが、みつからなかったのでGitHub Pagesで色々な知識をひけらかすためのJekyllテーマを作りました。ライセンスはMITです。</summary></entry><entry><title type="html">😀😬😁😂😃😄😅😆😇😉😊🙂☺️😋😌😍😘😗😙😚😜😝😛😎😏😶😐😑😒😳😞😟😠😡😔😕🙁☹️😣😖😫😩😤😮😱😨😰😯😦😧😢😥😪😓😭😵😲😷😴💤💩😈👿👹👺💀👻</title><link href="http://poem.mzyy94.com/items/jc" rel="alternate" type="text/html" title="😀😬😁😂😃😄😅😆😇😉😊🙂☺️😋😌😍😘😗😙😚😜😝😛😎😏😶😐😑😒😳😞😟😠😡😔😕🙁☹️😣😖😫😩😤😮😱😨😰😯😦😧😢😥😪😓😭😵😲😷😴💤💩😈👿👹👺💀👻" /><published>2017-04-25T10:00:00+00:00</published><updated>2017-04-25T10:00:00+00:00</updated><id>http://poem.mzyy94.com/items/jc</id><content type="html" xml:base="http://poem.mzyy94.com/items/jc">&lt;div align=&quot;center&quot; id=&quot;page_top&quot;&gt;
  &lt;img height=&quot;67&quot; src=&quot;/images/5f431f1d-7484-e7d5-5d70-817444b0bb5a.gif&quot; /&gt;
&lt;/div&gt;

&lt;hr /&gt;

&lt;div align=&quot;right&quot;&gt;
  &lt;b&gt;管理用リンク:&lt;/b&gt;
    &lt;a title=&quot;#comment_1&quot; href=&quot;#comment_1&quot;&gt;
      &lt;img class=&quot;avatar avatar-small&quot; alt=&quot;mzyy94&quot; width=&quot;40&quot; height=&quot;40&quot; data-proofer-ignore=&quot;true&quot; src=&quot;https://avatars3.githubusercontent.com/mzyy94?v=3&amp;amp;s=40&quot; srcset=&quot;https://avatars3.githubusercontent.com/mzyy94?v=3&amp;amp;s=40 1x, https://avatars3.githubusercontent.com/mzyy94?v=3&amp;amp;s=80 2x, https://avatars3.githubusercontent.com/mzyy94?v=3&amp;amp;s=120 3x, https://avatars3.githubusercontent.com/mzyy94?v=3&amp;amp;s=160 4x&quot; /&gt; 1コメ(業務連絡)
    &lt;/a&gt;
    &lt;a title=&quot;#comment_2&quot; href=&quot;#comment_2&quot;&gt;
      &lt;img class=&quot;avatar avatar-small&quot; alt=&quot;mzyy94&quot; width=&quot;40&quot; height=&quot;40&quot; data-proofer-ignore=&quot;true&quot; src=&quot;https://avatars3.githubusercontent.com/mzyy94?v=3&amp;amp;s=40&quot; srcset=&quot;https://avatars3.githubusercontent.com/mzyy94?v=3&amp;amp;s=40 1x, https://avatars3.githubusercontent.com/mzyy94?v=3&amp;amp;s=80 2x, https://avatars3.githubusercontent.com/mzyy94?v=3&amp;amp;s=120 3x, https://avatars3.githubusercontent.com/mzyy94?v=3&amp;amp;s=160 4x&quot; /&gt; 2コメ(業務連絡)
    &lt;/a&gt;
    &lt;a title=&quot;#comment_3&quot; href=&quot;#comment_3&quot;&gt;
      &lt;img class=&quot;avatar avatar-small&quot; alt=&quot;mzyy94&quot; width=&quot;40&quot; height=&quot;40&quot; data-proofer-ignore=&quot;true&quot; src=&quot;https://avatars3.githubusercontent.com/mzyy94?v=3&amp;amp;s=40&quot; srcset=&quot;https://avatars3.githubusercontent.com/mzyy94?v=3&amp;amp;s=40 1x, https://avatars3.githubusercontent.com/mzyy94?v=3&amp;amp;s=80 2x, https://avatars3.githubusercontent.com/mzyy94?v=3&amp;amp;s=120 3x, https://avatars3.githubusercontent.com/mzyy94?v=3&amp;amp;s=160 4x&quot; /&gt; 3コメ
    &lt;/a&gt;
    &lt;a title=&quot;#project1.bat&quot; href=&quot;https://jsfiddle.net/7p4wrhfr/&quot;&gt;
      &lt;img class=&quot;avatar avatar-small&quot; alt=&quot;mzyy94&quot; width=&quot;40&quot; height=&quot;40&quot; data-proofer-ignore=&quot;true&quot; src=&quot;https://avatars3.githubusercontent.com/mzyy94?v=3&amp;amp;s=40&quot; srcset=&quot;https://avatars3.githubusercontent.com/mzyy94?v=3&amp;amp;s=40 1x, https://avatars3.githubusercontent.com/mzyy94?v=3&amp;amp;s=80 2x, https://avatars3.githubusercontent.com/mzyy94?v=3&amp;amp;s=120 3x, https://avatars3.githubusercontent.com/mzyy94?v=3&amp;amp;s=160 4x&quot; /&gt; スクリプトを見る
    &lt;/a&gt;
    &lt;br /&gt;&lt;br /&gt;
    &lt;a target=&quot;_blank&quot; title=&quot;/items/yokunaine&quot; href=&quot;/items/yokunaine&quot;&gt;😎&lt;img alt=&quot;yokunaine&quot; src=&quot;https://raw.githubusercontent.com/mzyy94/yokunaine/master/client/icon16.png&quot; /&gt; よくないね&lt;/a&gt;
    &lt;a target=&quot;_blank&quot; title=&quot;/items/yokunaine&quot; href=&quot;/items/yokunaine&quot;&gt;😎&lt;img alt=&quot;yokunaine&quot; src=&quot;https://raw.githubusercontent.com/mzyy94/yokunaine/master/client/icon16.png&quot; /&gt; よくないね&lt;/a&gt;
    &lt;a target=&quot;_blank&quot; title=&quot;/items/yokunaine&quot; href=&quot;/items/yokunaine&quot;&gt;😎&lt;img alt=&quot;yokunaine&quot; src=&quot;https://raw.githubusercontent.com/mzyy94/yokunaine/master/client/icon16.png&quot; /&gt; よくないね&lt;/a&gt;
    &lt;br /&gt;&lt;br /&gt;
    &lt;a target=&quot;_blank&quot; title=&quot;😎見てね！&quot; href=&quot;/items/yokunaine2&quot;&gt;👎よくないね新バージョン開発中！&lt;/a&gt;
    &lt;a target=&quot;_blank&quot; title=&quot;よくないね！&quot; href=&quot;https://yokunaine.mzyy94.com&quot;&gt;👎よくないね集計&lt;/a&gt;
&lt;/div&gt;

&lt;hr /&gt;

&lt;div align=&quot;center&quot;&gt;
  &lt;h2&gt;✉&lt;b&gt;新着メッセージ(&lt;a title=&quot;#messages&quot; href=&quot;#comment_4&quot;&gt;全て見る&lt;/a&gt;)&lt;/b&gt;✉&lt;/h2&gt;
&lt;/div&gt;

&lt;p&gt;&lt;kbd&gt;2017/04/26&lt;/kbd&gt; タイトルの前後で関連性がないという編集リクエストがたくさん飛んできたので最初の状態にもどしました！&lt;/p&gt;

&lt;p&gt;&lt;kbd&gt;2017/04/26&lt;/kbd&gt; 技術系のタグをつけたのはプログラミングの話だからね！文句は運営に言ってね！&lt;/p&gt;

&lt;p&gt;&lt;kbd&gt;2017/04/26&lt;/kbd&gt;&lt;br /&gt;
&lt;img src=&quot;/images/f2caa3a0-eb15-7fa6-4549-1d3d8c944db9.png&quot; alt=&quot;スクリーンショット 2017-04-26 8.53.07.png&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;kbd&gt;2017/04/25&lt;/kbd&gt;コードだよ&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;html&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;lang=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;en&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;meta&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;charset=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;UTF-8&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;meta&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;viewport&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;content=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;width=device-width, initial-scale=1.0&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;meta&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;http-equiv=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;X-UA-Compatible&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;content=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;ie=edge&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;link&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;https://fonts.googleapis.com/css?family=Bangers&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;rel=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;stylesheet&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;@JAVASCRIPT&lt;span class=&quot;nt&quot;&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;canvas&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;width=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;360&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;height=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;60&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;span&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;style=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;
            font: 68px 'Bangers';
            color: #24f;
            text-shadow: 1px 0.5px 0 #888, 2px 1px 0 #888, 3px 1.5px 0 #888;
            font-weight: 100;
        &quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;@JAVASCRIPT&lt;span class=&quot;nt&quot;&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/canvas&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;span&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;
        &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;
        &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;y&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;56&lt;/span&gt;
        &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;text&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

        &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;canvas&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;canvas&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;canvas&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getContext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;2d&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;font&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;style&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;font&lt;/span&gt;

        &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;canvas2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;canvas&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;canvas2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;width&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;canvas&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;width&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;canvas2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;height&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;canvas&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;height&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;ctx2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;canvas2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getContext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;2d&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;ctx2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;font&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;style&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;font&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;ctx2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fillStyle&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ctx2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;shadowColor&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;white&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;ctx2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;shadowBlur&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;

        &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;offset&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;span&lt;/span&gt;
        &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;draw&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;clearRect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;canvas&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;canvas&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fillStyle&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#888&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fillText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;innerText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;y&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fillStyle&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;style&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;color&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fillText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;innerText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

            &lt;span class=&quot;nx&quot;&gt;ctx2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;clearRect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;canvas2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;canvas2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;36&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;36&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;22&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                    &lt;span class=&quot;nx&quot;&gt;ctx2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fillRect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1.6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1.6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;ctx2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;globalCompositeOperation&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;destination-in&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;ctx2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fillText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;innerText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;offset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;offset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;ctx2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;globalCompositeOperation&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;source-over&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;ctx2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;drawImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;canvas2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

            &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;drawImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;canvas2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;offset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;offset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;offset&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;offset&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;span&lt;/span&gt; 
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;draw&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;setInterval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;draw&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;kbd&gt;2017/04/25&lt;/kbd&gt;デモ追加❤️&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jsfiddle.net/7p4wrhfr/&quot;&gt;https://jsfiddle.net/7p4wrhfr/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;kbd&gt;2017/04/26&lt;/kbd&gt; 数あるゴミ記事を差し置いてこの記事を限定公開にするとはさすが！！技術的内容が皆無な記事よりはコード貼ってあったりして「ぷろぐらみんぐと関係のある投稿」ではあるんだけどなー？&lt;/p&gt;

&lt;p&gt;漢はコードで語れと言われてきた2020年代の今も説明文を書かなきゃいけないのびっくりだけど、わざわざ説明してあげるね！&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;トップの画像にあるような若干立体的な文字の表面にドット模様が動いてるロゴをcanvasで作ろうと思った時、どうやって表現するかのお話。&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;立体っぽく見せるために斜めにずらした灰色の文字を３回描画します。&lt;/p&gt;

    &lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
     &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fillText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;innerText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;y&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;表面の文字を描画します。&lt;/p&gt;

    &lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fillText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;innerText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;別のキャバスにドット模様を描きます。&lt;/p&gt;

    &lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
     &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;36&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;36&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;22&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
         &lt;span class=&quot;nx&quot;&gt;ctx2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fillRect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1.6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1.6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;文字の型でドット模様を切り抜きます。&lt;/strong&gt;&lt;/p&gt;

    &lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; &lt;span class=&quot;nx&quot;&gt;ctx2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;globalCompositeOperation&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;destination-in&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;
 &lt;span class=&quot;nx&quot;&gt;ctx2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fillText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;innerText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;offset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;offset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;ドット模様を濃くします。&lt;/p&gt;

    &lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; &lt;span class=&quot;nx&quot;&gt;ctx2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;globalCompositeOperation&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;source-over&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;
 &lt;span class=&quot;nx&quot;&gt;ctx2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;drawImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;canvas2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;ドット模様を描いたキャンバスを文字の書いてあるキャンバスに載せます。&lt;/p&gt;

    &lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;drawImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;canvas2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;offset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;offset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;offsetをずらして動いているように見せてるよ！&lt;/p&gt;</content><author><name>mzyy94</name></author><category term="ポエム" /><category term="JavaScript" /><category term="canvas" /><summary type="html"></summary></entry><entry><title type="html">よくないねボタン0.1 ～ReactからVueへ、そしてFluxの消失～</title><link href="http://poem.mzyy94.com/items/yokunaine2" rel="alternate" type="text/html" title="よくないねボタン0.1 ～ReactからVueへ、そしてFluxの消失～" /><published>2017-04-11T13:45:14+00:00</published><updated>2017-04-11T13:45:14+00:00</updated><id>http://poem.mzyy94.com/items/yokunaine2</id><content type="html" xml:base="http://poem.mzyy94.com/items/yokunaine2">&lt;p&gt;&lt;a href=&quot;/items/yokunaine&quot;&gt;よくないねボタン - Poem&lt;/a&gt;&lt;br /&gt;
よくないよ。こんなこと&lt;br /&gt;
大好評をいただいている&lt;a href=&quot;/items/yokunaine&quot;&gt;よくないねボタン&lt;/a&gt;ですが、おかげさまで512よくないねを達成しました:tada:&lt;br /&gt;
それを記念して、大幅にちょっとだけ変更を加えました。バージョン：0.0.4⇒0.1.0&lt;br /&gt;
&lt;em&gt;&lt;strong&gt;変更点をご紹介します！&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h1 id=&quot;rfc-7807に対応した&quot;&gt;RFC 7807に対応した&lt;/h1&gt;
&lt;p&gt;めちゃくちゃどうでもいいことですが、エラー表現を&lt;a href=&quot;https://tools.ietf.org/html/rfc7807&quot;&gt;RFC 7807&lt;/a&gt;に対応させました。エラーなんて見る人いないと思いますが、ちゃんとContent-Typeは&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;application/problem+json&lt;/code&gt;になっています。&lt;/p&gt;

&lt;h1 id=&quot;reactからvuejsに乗り換えた&quot;&gt;ReactからVue.jsに乗り換えた&lt;/h1&gt;
&lt;p&gt;だいたいここに書いてあることに共感したためです。&lt;br /&gt;
&lt;a href=&quot;http://postd.cc/why-we-chose-vuejs-over-react/&quot;&gt;私たちはなぜReactではなくVue.jsを選んだのか | プログラミング | POSTD&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;忌まわしきJSX&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;必要な道具が多すぎる&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;React+ReduxからVue+Vuexに乗り換えました。&lt;/p&gt;

&lt;h3 id=&quot;利点1トランスパイルいらず&quot;&gt;利点1：トランスパイルいらず&lt;/h3&gt;
&lt;p&gt;トランスパイルとかうんざり。そもそもこんなミクロなプロダクトにReactはデカすぎた。&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;ref. &lt;a href=&quot;http://kikuchi1201.hateblo.jp/entry/2016/10/26/172404&quot;&gt;【翻訳】 2016年にJavaScriptを学んでどう感じたか - Endo Tech Blog&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;ref. &lt;a href=&quot;https://medium.com/japan/2016%E5%B9%B4%E3%81%ABjavascript%E3%82%92%E5%AD%A6%E3%81%B6%E3%81%A8%E3%81%93%E3%82%93%E3%81%AA%E6%84%9F%E3%81%98-b969f5767d7c&quot;&gt;2016年にJavaScriptを学ぶとこんな感じ – Medium Japan – Medium&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;利点2コード量の減少&quot;&gt;利点2：コード量の減少&lt;/h3&gt;
&lt;p&gt;Reactですべてがすべて出来上がっているページではなく、拡張機能としてページに対してコードをインジェクトしているため、どうしてもDOM操作が絡んできます。その都合上、Reactのクリーンな設計を前にしても、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;document.querySelector&lt;/code&gt;でごちゃごちゃ弄っている部分が多くありました。&lt;br /&gt;
Reactでは、仮想DOM&lt;sup id=&quot;fnref:1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;（？）で作られたCoolな要素をインジェクションするためのdivラッパーを挿入したり、各コンポーネントに分けたクラスをrenderしたりするためにコンポーネントの定義とは別に追加で多く書く必要があったりしていました。&lt;/p&gt;

&lt;p&gt;対してVueではコンポーネントの定義と同時に&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;el&lt;/code&gt;オプションでマウントする要素を指定でき、1つのコンポーネントで記述量が減りました。&lt;br /&gt;
全体のコード記述量も減り、Reactで各コンポーネントに分かれたjsxファイルとindex.jsファイルの累計コード行数が200行を超えていたのに対し、VueではCommonJSを意識しなくしてindex.jsファイルのみに収め、160行程度になりました。&lt;br /&gt;
トランスパイル後のReactで書いたものが20000行を超えていたのに対し、Vueのほうはというと、vue.jsとvuex.jsとindex.jsの行数を足し合わせても10000と数百行になりました。&lt;/p&gt;
&lt;h2 id=&quot;fluxモデルをやめた&quot;&gt;Fluxモデルをやめた&lt;/h2&gt;
&lt;p&gt;React+ReduxからVue+Vuexに移行したものの、Reduxの時と変わらずFluxストアに対する値の操作がとてもめんどくさいものでした。Fluxストアに対してdispatchする日々は変わらず、そもそも大げさにState管理をするほどでもないことに気付いたのでFluxやめました。ReduxでsetStateばかり書いてあるコード見るのも辛いしね。&lt;br /&gt;
そもそもなんでステート管理をしていたかというと、各コンポーネント間でよくないねの状態を共有する必要があったからでした。&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-graphviz:図1&quot;&gt;digraph G {
	graph [
	layout=neato
	];
	edge [
	labelfloat=false
	];
	&quot;Store&quot; [shape=doublecircle];
	&quot;LikeButton&quot; [shape=box];
	&quot;Label&quot; -&amp;gt; &quot;Store&quot; [label=&quot;count&quot;, style=dotted ,len=2];
	&quot;Button&quot; -&amp;gt; &quot;Store&quot; [label=&quot;diasliked&quot;, labelfloat=false, len=2, labelloc=&quot;t&quot;, labeljust=&quot;r&quot;];
	&quot;Button&quot; -&amp;gt; &quot;Store&quot; [label=&quot;liked&quot;, style=dotted, len=2];
	&quot;Warning&quot; -&amp;gt; &quot;Store&quot; [label=&quot;count &amp;gt;= 2, style=dotted, len=2];
	&quot;LikeButton&quot; -&amp;gt; &quot;Store&quot; [label=&quot;liked&quot;, len=2];
	&quot;LikeButton&quot; -&amp;gt; &quot;Store&quot; [label=&quot;disliked&quot;, style=dotted, len=2];
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Vueは全体の状態の値の変化を即座にキャッチしてくれるので、ReduxのsubscribeやgetStateを必要としません。&lt;br /&gt;
そのため、Fluxによる管理をやめて、値を最も多く扱うコンポーネントに値を保持させ、それを他のコンポーネントから参照させる形にしました。&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-graphviz:図2&quot;&gt;digraph G {
	graph [
	layout=fdp
	];
	edge [
	labelfloat=false
	];
	&quot;LikeButton&quot; [shape=box];
	&quot;Button&quot; [xlabel=&quot;liked, disliked&quot;];
	&quot;Label&quot; [xlabel=&quot;count&quot;];
	&quot;Warning&quot; -&amp;gt; &quot;Label&quot; [label=&quot;count&quot;, style=dotted, len=2];
	&quot;Button&quot; -&amp;gt; &quot;Label&quot; [label=&quot;count&quot;, len=2];
	&quot;LikeButton&quot; -&amp;gt; &quot;Button&quot; [label=&quot;liked&quot;, len=2];
	&quot;LikeButton&quot; -&amp;gt; &quot;Button&quot; [label=&quot;disliked&quot;, style=dotted, len=2];
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;これでVuexとはおさらば、さらにコード記述量が減り、140行程度まで小さくなりました。vue.jsとindex.jsを合わせても10000行にも満たなくなりました。&lt;/p&gt;
&lt;h2 id=&quot;vuejsのセキュリティ上の懸念点&quot;&gt;Vue.jsのセキュリティ上の懸念点&lt;/h2&gt;
&lt;p&gt;Vueは便利に書ける反面、セキュリティ上の懸念点が少々あります。よくないねの設定ページもVueで記述していたのですが、最初は動かなくてとても困っていました。いろいろ調べていると原因はCSPでした。&lt;br /&gt;
&lt;a href=&quot;https://developer.chrome.com/extensions/contentSecurityPolicy&quot;&gt;Content Security Policy (CSP) - Google Chrome&lt;/a&gt;&lt;br /&gt;
Chrome拡張機能はデフォルトで&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;script-src 'self'; object-src 'self'&lt;/code&gt;のポリシーが割り当てられています。しかし、VueJSはテンプレートのコンパイルに&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;new Function()&lt;/code&gt;を用いているようです。&lt;br /&gt;
&lt;a href=&quot;https://jp.vuejs.org/v2/guide/installation.html#CSP-環境&quot;&gt;インストール CSP 環境 - Vue.js&lt;/a&gt;&lt;br /&gt;
この問題を解決するために、CSPを変更して安全でない評価関数の実行を有効にしてあげる必要がありました。これにより、悪意のあるコードが設定ページに注入されることが万が一にでもあった場合、その攻撃を受けてしまう可能性が微粒子レベルで上昇してしまいました。&lt;br /&gt;
まぁそこまで気にすることではないんですがね。&lt;/p&gt;
&lt;h1 id=&quot;ポップアップメニューを追加してよくないね総数を確認できようにした&quot;&gt;ポップアップメニューを追加してよくないね総数を確認できようにした&lt;/h1&gt;
&lt;p&gt;よくないね総数を確認して世のよくない記事の数を聢と見よ。&lt;/p&gt;
&lt;h1 id=&quot;semantic-uiやめてuikit3にした&quot;&gt;Semantic UIやめてUIKit3にした&lt;/h1&gt;
&lt;p&gt;そもそもどこでそんなUIがあったのか気づいてない人多いと思いますが、設定ページのUIがそれです。&lt;br /&gt;
&lt;a href=&quot;https://semantic-ui.com/&quot;&gt;Semantic UI&lt;/a&gt;使ってた理由がReactコンポーネントとして使えてたからってたけなので、&lt;a href=&quot;https://getuikit.com/&quot;&gt;UIKit3(beta)&lt;/a&gt;に変えました。UIKitは昔と比べて見た目が良くなってきましたね。&lt;/p&gt;
&lt;h1 id=&quot;よくないねページから直接インストールできるようにした&quot;&gt;よくないねページから直接インストールできるようにした&lt;/h1&gt;
&lt;p&gt;よくないね総数が見られる&lt;a href=&quot;https://yokunaine.mzyy94.com&quot;&gt;yokunaine.mzyy94.com&lt;/a&gt;のページから拡張機能をダウンロードできるようにしました。Inline installationを試してみたかったので。&lt;br /&gt;
&lt;a href=&quot;http://qiita.com/komasshu/items/f70984b3ecc985e916f3&quot;&gt;Chrome Extension inline installationの使い方 - Qiita&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&quot;おしまい&quot;&gt;おしまい&lt;/h1&gt;
&lt;p&gt;なんかいっぱい書こうと思ったけど疲れたのでおしまい。前回&lt;a href=&quot;http://qiita.com/mzyy94/items/7e816b7bed2d1e7fb584#%E3%81%82%E3%81%A8%E3%81%8C%E3%81%8D&quot;&gt;予告&lt;/a&gt;していたyokunaineの実装に関するGoodな点の話はいろいろと語り尽くされてる感じがして書くのめんどくさいのでコードみて確認してください。&lt;/p&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;http://postd.cc/the-inner-workings-of-virtual-dom/&quot;&gt;仮想DOMの内部の動き | プログラミング | POSTD&lt;/a&gt; &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;</content><author><name>mzyy94</name></author><category term="よくないね" /><category term="いいね" /><category term="ポエム" /><summary type="html">よくないねボタン - Poem よくないよ。こんなこと 大好評をいただいているよくないねボタンですが、おかげさまで512よくないねを達成しました:tada: それを記念して、大幅にちょっとだけ変更を加えました。バージョン：0.0.4⇒0.1.0 変更点をご紹介します！</summary></entry><entry><title type="html">よくないねボタン</title><link href="http://poem.mzyy94.com/items/yokunaine" rel="alternate" type="text/html" title="よくないねボタン" /><published>2016-12-04T10:10:00+00:00</published><updated>2016-12-04T10:10:00+00:00</updated><id>http://poem.mzyy94.com/items/yokunaine</id><content type="html" xml:base="http://poem.mzyy94.com/items/yokunaine">&lt;p&gt;いいね だけじゃ　だめなんだよ。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://help.qiita.com/ja/articles/qiita-article-guideline&quot;&gt;良い記事を書くためのガイドライン - Qiita:Support&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;こういうガイドラインがあるけども、これに沿った良い記事なんて半分もないんだよ。&lt;br /&gt;
質問の場所と勘違いしている記事や、READMEを貼り付けただけの記事、ブックマークサービスとしてURL貼るだけの記事ばかり。&lt;br /&gt;
Googleで「あれどうやるんだっけ」と調べるとトップにQiitaが出てきて開いてみると、&lt;br /&gt;
「このブログにやりかたが書いてありました！」なんて記事ばっか。&lt;br /&gt;
そんなんだったらそのブログに検索トップの座をゆずれよお前の記事が邪魔してるんだよ。&lt;/p&gt;

&lt;p&gt;そして先日、良い記事がごく少数なのにもかかわらず「👍いいね」ボタンなる間抜けな実装が追加されてゴミ記事にうんざりしている人たちは憤怒ですよ。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://qiita.com/bezeklik/items/e28ab36e1071e761a277&quot;&gt;「いいね」が使えないのはどう考えてもQiitaが悪い - Qiita&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;もうだめだよね。「👍いいね」なんて。どうせなら「🍣すし」にしてほしかったくらいだよ。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://poem.mzyy94.com/items/like2sushi&quot;&gt;Twitterの仕様変更を受け入れられなくなったので:heart:を:sushi:に変えて精神を落ち着かせる - Poem&lt;/a&gt;&lt;/p&gt;

&lt;blockquote class=&quot;twitter-tweet&quot; data-lang=&quot;ja&quot;&gt;&lt;p lang=&quot;ja&quot; dir=&quot;ltr&quot;&gt;Qiitaの「👍いいね」がイラっとするので内容の無いポストに対して「👎よくないね」を付けるウェブサービスとChrome拡張を作りたい&lt;/p&gt;&amp;mdash; はいふり@3日目東v-14a (@mzyy94) &lt;a href=&quot;https://twitter.com/mzyy94/status/801694537219444736&quot;&gt;2016年11月24日&lt;/a&gt;&lt;/blockquote&gt;
&lt;script async=&quot;&quot; src=&quot;//platform.twitter.com/widgets.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;

&lt;hr /&gt;

&lt;p&gt;と、愚痴を言いだしたら冬コミの薄い本以上に書き上がりそうなのでほどほどにしておいて、&lt;br /&gt;
おなじみの&lt;strong&gt;技術で歯向かえ「いいね」ボタン&lt;/strong&gt;の新作、「👎よくないね」ボタンが出来上がりました。&lt;/p&gt;

&lt;h3 id=&quot;mzyy94yokunaine-よくないね&quot;&gt;&lt;a href=&quot;https://github.com/mzyy94/yokunaine/&quot;&gt;mzyy94/yokunaine: よくないね。&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;今回はChrome拡張機能として実装しました。Firefoxは知りません。&lt;br /&gt;
拡張機能をインストールしてトークンを取得すると、各記事によくないねボタンが現れます。&lt;br /&gt;
ためしにこの記事に「👎よくないね」をつけてみてください。&lt;/p&gt;

&lt;blockquote class=&quot;twitter-tweet&quot; data-conversation=&quot;none&quot; data-lang=&quot;ja&quot;&gt;&lt;p lang=&quot;ja&quot; dir=&quot;ltr&quot;&gt;震えて眠れプロポエマー &lt;a href=&quot;https://t.co/19gGUsZFDa&quot;&gt;pic.twitter.com/19gGUsZFDa&lt;/a&gt;&lt;/p&gt;&amp;mdash; はいふり@3日目東v-14a (@mzyy94) &lt;a href=&quot;https://twitter.com/mzyy94/status/803071379654352896&quot;&gt;2016年11月28日&lt;/a&gt;&lt;/blockquote&gt;
&lt;script async=&quot;&quot; src=&quot;//platform.twitter.com/widgets.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;

&lt;p&gt;先日Lightsailなるお手軽なインスタンスが立ち上がったのでAWSで「よくないね」の数を集計します。&lt;br /&gt;
使い方は上記リポジトリを確認してください。&lt;/p&gt;

&lt;p&gt;追記：&lt;/p&gt;

&lt;blockquote class=&quot;twitter-tweet&quot; data-conversation=&quot;none&quot; data-lang=&quot;ja&quot;&gt;&lt;p lang=&quot;ja&quot; dir=&quot;ltr&quot;&gt;動かない人、ちゃんとREADME読んでオプションページからTOKEN取得してね！！！ &lt;a href=&quot;https://t.co/lcqSpKcA9s&quot;&gt;pic.twitter.com/lcqSpKcA9s&lt;/a&gt;&lt;/p&gt;&amp;mdash; 岬明乃@3日目東v-14a (@mzyy94) &lt;a href=&quot;https://twitter.com/mzyy94/status/805362469543649280&quot;&gt;2016年12月4日&lt;/a&gt;&lt;/blockquote&gt;
&lt;script async=&quot;&quot; src=&quot;//platform.twitter.com/widgets.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;あとがき&quot;&gt;あとがき&lt;/h1&gt;

&lt;p&gt;&lt;del&gt;たぶんこの記事も&lt;a href=&quot;https://qiita.com/terms&quot;&gt;利用規約 - Qiita&lt;/a&gt;に違反しているとかなんとか言われて消されるんだろうなぁ。&lt;/del&gt;&lt;br /&gt;
&lt;del&gt;ほかにもっと消えるべき記事はたくさんあるのに。&lt;/del&gt;&lt;br /&gt;
&lt;del&gt;もし消えなかったら2017年に向けたモダンな技術をふんだんに使ったこの拡張機能の技術説明記事を書いてもいいかなーって。&lt;/del&gt;&lt;br /&gt;
&lt;del&gt;この拡張機能ほんとすごいんだよ。&lt;/del&gt;&lt;br /&gt;
&lt;del&gt;拡張機能の方のコードはReact+ES2015だしサーバの方のコードなんて200行足らずで描き上がってるんだよ。&lt;/del&gt;&lt;br /&gt;
&lt;del&gt;めちゃくちゃ機能の紹介したいよ。JavaScriptの良さみんなにいっぱい知ってほしいよ。&lt;/del&gt;&lt;/p&gt;</content><author><name>mzyy94</name></author><category term="いいね" /><category term="よくないね" /><category term="技術で歯向かえ「いいね」ボタン" /><category term="ポエム" /><summary type="html">いいね だけじゃ　だめなんだよ。</summary></entry><entry><title type="html">B−CASリーダをDocker内で読もうとしてlibpcscliteのバージョン違いではまった話</title><link href="http://poem.mzyy94.com/items/card-reader" rel="alternate" type="text/html" title="B−CASリーダをDocker内で読もうとしてlibpcscliteのバージョン違いではまった話" /><published>2016-07-03T07:35:00+00:00</published><updated>2016-07-03T07:35:00+00:00</updated><id>http://poem.mzyy94.com/items/card-reader</id><content type="html" xml:base="http://poem.mzyy94.com/items/card-reader">&lt;p&gt;ChinachuをDockerに入れようとしたらカードリーダーがB−CASをうまく認識しなくてつらかった話。&lt;/p&gt;

&lt;p&gt;結論から言うと、ホストの&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pcscd&lt;/code&gt;とゲストの&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pcsc_scan&lt;/code&gt;のpcscliteのライブラリのバージョン違いが問題でしたって話。&lt;br /&gt;
要するにこんなかんじ（表1)。&lt;/p&gt;

&lt;p&gt;表1. 要するにこんなかんじ&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;OS&lt;/th&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;libpcscliteのバージョン&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;CentOS 7.2&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;pcsc-lite-libs 1.8.8&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;Debian jessie 8.5&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;libpcsclite1 1.8.13&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pcscd&lt;/code&gt;の使うライブラリのマイナーバージョンより&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pcsc_scan&lt;/code&gt;のライブラリのマイナーバージョンが新しいと動かないということだった。&lt;br /&gt;
解決する方法は２パターンあって、&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;ホスト側（&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pcscd&lt;/code&gt;側）のライブラリのバージョンを1.8.8で保持してゲスト側(&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pcsc_scan&lt;/code&gt;側）を1.8.8以前にダウングレード&lt;/li&gt;
  &lt;li&gt;ホスト側のライブラリを1.8.8以上にアップデード&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;今回はホスト側を汚さないように前者の解決策をとって、wheezy向けのlibpcscliteをインストールして解決した。&lt;br /&gt;
おしまい。&lt;/p&gt;

&lt;hr /&gt;
&lt;p&gt;以下、駄文なので見なくていいです。&lt;/p&gt;

&lt;h2 id=&quot;そもそもなんで動かなかったの&quot;&gt;そもそもなんで動かなかったの？&lt;/h2&gt;

&lt;p&gt;CentOS側で動かしてる&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pcscd&lt;/code&gt;にDebian jessieから&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pcsc_scan&lt;/code&gt;してみたときの&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pcscd&lt;/code&gt;のログがこちら。&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;08174657 winscard_msg_srv.c:230:ProcessEventsServer() Common channel packet arrival
00000030 winscard_msg_srv.c:242:ProcessEventsServer() ProcessCommonChannelRequest detects: 9
00000007 pcscdaemon.c:93:SVCServiceRunLoop() A new context thread creation is requested: 9
00000098 winscard_svc.c:299:ContextThread() Thread is started: dwClientID=9, threadContext @0x555636dee7f0
00000025 winscard_svc.c:317:ContextThread() Received command: CMD_VERSION from client 9
00000009 winscard_svc.c:329:ContextThread() Client is protocol version 4:3
00000005 winscard_svc.c:338:ContextThread() Client protocol is 4:3
00000004 winscard_svc.c:340:ContextThread() Server protocol is 4:2
00000007 winscard_svc.c:349:ContextThread() CMD_VERSION rv=0x8010001D for client 9
00000238 winscard_svc.c:309:ContextThread() Client die: 9
00000024 winscard_svc.c:928:MSGCleanupClient() Thread is stopping: dwClientID=9, threadContext @0x555636dee7f0
00000007 winscard_svc.c:934:MSGCleanupClient() Freeing SCONTEXT @0x555636dee7f0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;クライアント、死す: 9&lt;/code&gt;って書いてあるように、クライアントが死んだらしい。&lt;/p&gt;

&lt;p&gt;対して同じCentOSホスト上で&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pcsc_scan&lt;/code&gt;を実行した時の&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pcscd&lt;/code&gt;のログがこちら&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;99551719 winscard_msg_srv.c:230:ProcessEventsServer() Common channel packet arrival
00000041 winscard_msg_srv.c:242:ProcessEventsServer() ProcessCommonChannelRequest detects: 9
00000008 pcscdaemon.c:93:SVCServiceRunLoop() A new context thread creation is requested: 9
00000103 winscard_svc.c:299:ContextThread() Thread is started: dwClientID=9, threadContext @0x555636db2f80
00000027 winscard_svc.c:317:ContextThread() Received command: CMD_VERSION from client 9
00000011 winscard_svc.c:329:ContextThread() Client is protocol version 4:2
00000005 winscard_svc.c:349:ContextThread() CMD_VERSION rv=0x0 for client 9
00000123 winscard_svc.c:317:ContextThread() Received command: ESTABLISH_CONTEXT from client 9
00000026 winscard.c:193:SCardEstablishContext() Establishing Context: 0x42ADED6E
00000007 winscard_svc.c:410:ContextThread() ESTABLISH_CONTEXT rv=0x0 for client 9
00000130 winscard_svc.c:317:ContextThread() Received command: CMD_GET_READERS_STATE from client 9
00000108 winscard_svc.c:317:ContextThread() Received command: CMD_GET_READERS_STATE from client 9
00000093 winscard_svc.c:317:ContextThread() Received command: CONNECT from client 9
00000021 winscard.c:235:SCardConnect() Attempting Connect to Gemalto PC Twin Reader 00 00 using protocol: 2
00000007 readerfactory.c:739:RFReaderInfo() RefReader() count was: 1
(略)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;クライアント、死なずにちゃんと最後まで動いた。&lt;/p&gt;

&lt;p&gt;ログのdiffをとったら怪しい行があった。&lt;/p&gt;

&lt;div class=&quot;language-diff highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;gi&quot;&gt;+ Client is protocol version 4:3
&lt;/span&gt;&lt;span class=&quot;gd&quot;&gt;- Client is protocol version 4:2
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;なにが違うのかstraceで確認してdiffしたところ、pcscdに対してpcsc_scanが送ってくるバイナリが違う部分があった。&lt;/p&gt;

&lt;div class=&quot;language-diff highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;gi&quot;&gt;+ read(9, &quot;\4\0\0\0\3\0\0\0\0\0\0\0&quot;, 12) = 12
+ write(1, &quot;00000116 winscard_svc.c:329:ContextThread() Client is protocol version 4:3\n&quot;, 75) = 75
&lt;/span&gt;&lt;span class=&quot;gd&quot;&gt;- read(9, &quot;\4\0\0\0\2\0\0\0\0\0\0\0&quot;, 12) = 12
- write(1, &quot;00000116 winscard_svc.c:329:ContextThread() Client is protocol version 4:2\n&quot;, 75) = 75
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;なるほどクライアントがサーバに要求するプロトコルバージョンが違うのか。&lt;/p&gt;

&lt;p&gt;で、libpcscliteの変更を疑って変更履歴を見てきたらビンゴ！プロトコルバージョンがちょうど1.8.8以前と1.8.9以後で変わっていることがわかった。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;pcsc-lite-1.8.9: Ludovic Rousseau&lt;br /&gt;
16 October 2013&lt;/p&gt;
  &lt;ul&gt;
    &lt;li&gt;SCardEndTransaction(): Return an error if is called with no&lt;br /&gt;
corresponding SCardBeginTransaction()&lt;br /&gt;
（中略）&lt;/li&gt;
    &lt;li&gt;Check the Info.plist file is (a minimum) correct&lt;/li&gt;
    &lt;li&gt;Update PROTOCOL_VERSION_MINOR from 2 to 3&lt;br /&gt;
（後略）&lt;/li&gt;
  &lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi?p=pcsclite/PCSC.git;a=blob;f=ChangeLog;hb=HEAD&lt;/p&gt;

&lt;p&gt;ホスト側はCentOS 7.2でlibpcscliteのバージョンが1.8.8、ゲスト側が1.8.13だったというマイナーバージョン程度の違いだけれども、後方互換を残さないような大きな変更があったとは疑いもせず１日をとかしてしまったというポエムでした。まぁ解決できたのでめでたしめでたし。&lt;/p&gt;</content><author><name>mzyy94</name></author><category term="pcscd" /><category term="docker" /><category term="libpcsclite" /><summary type="html">ChinachuをDockerに入れようとしたらカードリーダーがB−CASをうまく認識しなくてつらかった話。</summary></entry><entry><title type="html">Twitterの仕様変更を受け入れられなくなったので:heart:を:sushi:に変えて精神を落ち着かせる</title><link href="http://poem.mzyy94.com/items/like2sushi" rel="alternate" type="text/html" title="Twitterの仕様変更を受け入れられなくなったので:heart:を:sushi:に変えて精神を落ち着かせる" /><published>2015-11-04T07:50:00+00:00</published><updated>2015-11-04T07:50:00+00:00</updated><id>http://poem.mzyy94.com/items/like2sushi</id><content type="html" xml:base="http://poem.mzyy94.com/items/like2sushi">&lt;p&gt;昨夜未明、Twitter社はとある仕様変更を発表し、同時に実装に踏み切った。&lt;br /&gt;
今まで:star:として記されていたFavoriteが:heart:のLikeに変更となったのだ。&lt;br /&gt;
そしてこの一方的な変更を我々は強いられることとなった。&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;とまぁ我々がTwitter社の強制をそのまま受け入れるはずもなく、日本全国・世界各国でこの仕様変更に物議を醸し出している。&lt;br /&gt;
とりわけ日本の文化として、何においても:sushi:が至高であるという共通認識が全国民に常識として行き渡っているため、「:heart:になるくらいならば:sushi:にしてしまえ」という考えも多く出ている。&lt;br /&gt;
我ら日本人、技術力を駆使して外資系の企業に屈せぬよう努力を重ね、１日たたずとして世には:heart:を:sushi:に変更するプラグインなりが多数公開され、エンジニア各位がTwitter社に意思表明をしている。&lt;br /&gt;
私も仕様変更を知った時、敏感に反応した一人である。&lt;/p&gt;
&lt;blockquote class=&quot;twitter-tweet&quot; lang=&quot;ja&quot;&gt;&lt;p lang=&quot;ja&quot; dir=&quot;ltr&quot;&gt;Twitterの⭐️を🍣に変項すればこんなに問題視されなかっただろうに&lt;/p&gt;&amp;mdash; 友利奈緒 (@mzyy94) &lt;a href=&quot;https://twitter.com/mzyy94/status/661564921159680000&quot;&gt;2015, 11月 3&lt;/a&gt;&lt;/blockquote&gt;
&lt;script async=&quot;&quot; src=&quot;//platform.twitter.com/widgets.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;

&lt;p&gt;これを呟いた直後、Twitter社に意思表明すべくとある行動に出た。&lt;/p&gt;
&lt;blockquote class=&quot;twitter-tweet&quot; lang=&quot;ja&quot;&gt;&lt;p lang=&quot;ja&quot; dir=&quot;ltr&quot;&gt;俺は何をやってるんだ &lt;a href=&quot;https://t.co/f9eDZ5NKGU&quot;&gt;https://t.co/f9eDZ5NKGU&lt;/a&gt; &lt;a href=&quot;https://t.co/viNXuG3E3w&quot;&gt;pic.twitter.com/viNXuG3E3w&lt;/a&gt;&lt;/p&gt;&amp;mdash; 友利奈緒 (@mzyy94) &lt;a href=&quot;https://twitter.com/mzyy94/status/661570608229036033&quot;&gt;2015, 11月 3&lt;/a&gt;&lt;/blockquote&gt;
&lt;script async=&quot;&quot; src=&quot;//platform.twitter.com/widgets.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;

&lt;p&gt;CSSユーザースタイルシートを利用し、:heart:ボタンを:sushi:に置き換えるという意思表明をした。&lt;br /&gt;
直後、グレースケールの画像も用意し、仕様変更から１時間足らずで実用的な:sushi:ボタンの実装案を公開し、強い意思表明を行った。&lt;/p&gt;
&lt;blockquote class=&quot;twitter-tweet&quot; lang=&quot;ja&quot;&gt;&lt;p lang=&quot;ja&quot; dir=&quot;ltr&quot;&gt;🍣ボタンのグレースケールを追加して🍣の実用性が高まる &lt;a href=&quot;https://t.co/2MQbkUD3NK&quot;&gt;pic.twitter.com/2MQbkUD3NK&lt;/a&gt;&lt;/p&gt;&amp;mdash; 友利奈緒 (@mzyy94) &lt;a href=&quot;https://twitter.com/mzyy94/status/661579582177304577&quot;&gt;2015, 11月 3&lt;/a&gt;&lt;/blockquote&gt;
&lt;script async=&quot;&quot; src=&quot;//platform.twitter.com/widgets.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;

&lt;p&gt;追い打ちをかけるように、:heart:ボタンのアニメーションを真似たさらに強力な:sushi:ボタン意思表明を訴えた。&lt;/p&gt;
&lt;blockquote class=&quot;twitter-tweet&quot; lang=&quot;ja&quot;&gt;&lt;p lang=&quot;ja&quot; dir=&quot;ltr&quot;&gt;♥を🍣にするためだけにChrome拡張書くのはスマートじゃないから「いいね」の文字含め全部User Stylesheetでやろうと:after擬似要素やcontentで頑張って「いいね」を「すし」に書き換えてたけど結局のところ🍣アニメーションが製作できずで公開に踏み切れずにいる&lt;/p&gt;&amp;mdash; 友利奈緒 (@mzyy94) &lt;a href=&quot;https://twitter.com/mzyy94/status/661588651835441152&quot;&gt;2015, 11月 3&lt;/a&gt;&lt;/blockquote&gt;
&lt;script async=&quot;&quot; src=&quot;//platform.twitter.com/widgets.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;

&lt;p&gt;しかしTwitter民としてはあろうことか、まだ昼の26時であるのにもかかわらず眠気に襲われ、アニメーションの制作は断念。おふとぅんへと吸い込まれて行ったのである。&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;夜が明け目がさめると、私の意思表明に賛同した数千のTwitterユーザーからの熱い:heart:が届いていた。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;「こんなたくさんの:heart:に溺れさせられるTwitterはTwitterじゃない」&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;タスクの順序を整理し:heart:を:sushi:に置換する作業のプライオリティを最高に設定した。&lt;br /&gt;
すると、:sushi:アニメーション界のプロによってアニメーションの提供を受けることとなった。&lt;/p&gt;
&lt;blockquote class=&quot;twitter-tweet&quot; lang=&quot;ja&quot;&gt;&lt;p lang=&quot;ja&quot; dir=&quot;ltr&quot;&gt;あとでみっきー氏に🍣アニメーションを送って公開してもらおう。&lt;/p&gt;&amp;mdash; みくげっと (@3qgt) &lt;a href=&quot;https://twitter.com/3qgt/status/661710377772691457&quot;&gt;2015, 11月 4&lt;/a&gt;&lt;/blockquote&gt;
&lt;script async=&quot;&quot; src=&quot;//platform.twitter.com/widgets.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;

&lt;p&gt;いただいた画像を取り込み、ユーザースタイルシートによってアニメーション及びTooltipの文字を置換するCSSファイルを完成させた。&lt;/p&gt;
&lt;blockquote class=&quot;twitter-video&quot; lang=&quot;ja&quot;&gt;&lt;p lang=&quot;ja&quot; dir=&quot;ltr&quot;&gt;Twitterの仕様変更を受け入れられなくなったので:heart:を:sushi:に変えて精神を落ち着かせる - Qiita &lt;a href=&quot;https://t.co/slx55fcZ07&quot;&gt;https://t.co/slx55fcZ07&lt;/a&gt; &lt;a href=&quot;https://t.co/CRrUMWhziE&quot;&gt;pic.twitter.com/CRrUMWhziE&lt;/a&gt;&lt;/p&gt;&amp;mdash; 友利奈緒 (@mzyy94) &lt;a href=&quot;https://twitter.com/mzyy94/status/661818637418762240&quot;&gt;2015, 11月 4&lt;/a&gt;&lt;/blockquote&gt;
&lt;script async=&quot;&quot; src=&quot;//platform.twitter.com/widgets.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;

&lt;h2 id=&quot;like2sushi&quot;&gt;like2sushi&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://github.com/mzyy94/like2sushi&quot;&gt;https://github.com/mzyy94/like2sushi&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;[2015-11-4 18:38追記] @3qgtさんによるChrome拡張機能がマージされたので、Chromeに導入の際はリポジトリのREADME.mdに記載の手順でワンステップで:sushi:化できる。&lt;/p&gt;

&lt;p&gt;ユーザースタイルシートとして:sushi:を適用する先駆者がすでにおられるので、導入方法はそちらを参照されたい。&lt;br /&gt;
&lt;a href=&quot;http://qiita.com/GODVA_GOBBA/items/34fd127578ddb91dfd82&quot;&gt;Twitterのふぁぼマークを寿司にする - Qiita&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;以上、快適なTwitterライフのため、少しでも力になれたらと思う。&lt;/p&gt;</content><author><name>mzyy94</name></author><category term="Twitter" /><category term="CSS3" /><category term="sushi" /><category term="🍣" /><category term="技術で歯向かえ「いいね」ボタン" /><summary type="html">昨夜未明、Twitter社はとある仕様変更を発表し、同時に実装に踏み切った。 今まで:star:として記されていたFavoriteが:heart:のLikeに変更となったのだ。 そしてこの一方的な変更を我々は強いられることとなった。</summary></entry><entry><title type="html">koaで画像拾ってきてそのまま返すyieldableでスマートな処理</title><link href="http://poem.mzyy94.com/items/koa-image" rel="alternate" type="text/html" title="koaで画像拾ってきてそのまま返すyieldableでスマートな処理" /><published>2014-04-22T16:51:00+00:00</published><updated>2014-04-22T16:51:00+00:00</updated><id>http://poem.mzyy94.com/items/koa-image</id><content type="html" xml:base="http://poem.mzyy94.com/items/koa-image">&lt;p&gt;別のサーバーにある画像ファイルを、koaで動作しているサービスから渡す必要に迫られました。&lt;br /&gt;
そんなときにもkoa。スマートに仕上げてくれます。&lt;/p&gt;

&lt;h2 id=&quot;コード-samplejs&quot;&gt;コード (sample.js)&lt;/h2&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;koa&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;koa&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;route&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;koa-route&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;koa&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//-- ここから下はcoのサンプルから&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;thunkify&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;thunkify&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;request&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;defaults&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;encoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//←これがミソ！&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;thunkify&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//!-- ここまで&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;route&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;/hoge.png&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;url&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;http://www.google.co.jp/images/srpr/logo11w.png&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;img&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;yield&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;img&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;headers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;content-type&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//ヘッダー付ける&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;body&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;img&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//Bufferオブジェクト&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}));&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;listen&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;実行&quot;&gt;実行&lt;/h2&gt;
&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;node --harmony sample.js&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;結果&quot;&gt;結果&lt;/h2&gt;
&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;curl -v localhost:3000/hoge.png&lt;/code&gt;&lt;br /&gt;
もしくは&lt;br /&gt;
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;open http://localhost:3000/hoge.png&lt;/code&gt; (OS X限定)&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/af9215b9-528a-70b3-a49d-cbe0679020b9.png&quot; alt=&quot;スクリーンショット 2014-04-23 1.25.49.png&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;まとめ&quot;&gt;まとめ&lt;/h2&gt;
&lt;p&gt;yieldを使った非同期処理を同期っぽくこなす場合はその処理がyieldableである必要があります。&lt;br /&gt;
httpをつかったファイルのダウンロードをyieldableな処理で実行するサンプルコードは、koaのベースとなる&lt;a href=&quot;https://github.com/visionmedia/co&quot;&gt;Co&lt;/a&gt;のReadmeに書いてあります。&lt;br /&gt;
今回はそちらの利用方法を参考にさせてもらいました。&lt;/p&gt;

&lt;p&gt;Coにあるサンプルコードのままでは、バイナリデータを扱うようなことはできません。&lt;br /&gt;
request.getが取得したデータをテキストとして解釈してしまうためです。&lt;br /&gt;
それを防ぐために、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;default({ encoding: null })&lt;/code&gt;とオプションを指定します。&lt;br /&gt;
これで正常にバイナリデータをBufferとして扱えるようになります。&lt;/p&gt;

&lt;p&gt;JSONオブジェクトを渡した際は、Content-Typeが&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;application/json&lt;/code&gt;にセットされていたのですが、今回のようにBufferが渡された場合は、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;application/octet-stream&lt;/code&gt;がセットされてしまいます。&lt;br /&gt;
仕方がないので、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;this.type&lt;/code&gt;にダウンロードしたファイルのHTTPヘッダ情報から得たContetn-Typeを入れてあげます。&lt;/p&gt;

&lt;p&gt;そこまでスマートではないですが、今までのcallback地獄よりはきれいに書けると思います。&lt;/p&gt;

&lt;p&gt;koa、使わない手はないでしょう。&lt;/p&gt;</content><author><name>mzyy94</name></author><category term="Koa" /><category term="Node.js" /><category term="JavaScript" /><summary type="html">別のサーバーにある画像ファイルを、koaで動作しているサービスから渡す必要に迫られました。 そんなときにもkoa。スマートに仕上げてくれます。</summary></entry><entry><title type="html">koaでJSON返させるシンプルで唯一の記述</title><link href="http://poem.mzyy94.com/items/koa-simple-json" rel="alternate" type="text/html" title="koaでJSON返させるシンプルで唯一の記述" /><published>2014-04-21T10:30:14+00:00</published><updated>2014-04-21T10:30:14+00:00</updated><id>http://poem.mzyy94.com/items/koa-simple-json</id><content type="html" xml:base="http://poem.mzyy94.com/items/koa-simple-json">&lt;p&gt;koaでRESTなものを作ろうと思ったときにJSONでオブジェクトを返す必要がでてきました。&lt;br /&gt;
いろいろなことが便利になったkoa、JSONを返すコードも素敵に書くことができます。&lt;/p&gt;
&lt;h2 id=&quot;コード-samplejs&quot;&gt;コード (sample.js)&lt;/h2&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;koa&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;koa&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;route&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;koa-route&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;koa&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// respond JSON&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;route&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;/hoge.json&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;c1&quot;&gt;// set Object you want to respond&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;body&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;foo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;bar&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}));&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;listen&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h2 id=&quot;実行&quot;&gt;実行&lt;/h2&gt;
&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;node --harmony sample.js&lt;/code&gt;&lt;/p&gt;
&lt;h2 id=&quot;結果&quot;&gt;結果&lt;/h2&gt;
&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;curl -v localhost:3000/hoge.json&lt;/code&gt;&lt;br /&gt;
もしくは&lt;br /&gt;
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;open http://localhost:3000/hoge.json&lt;/code&gt; (OS X限定)&lt;br /&gt;
&lt;img src=&quot;/images/4cee5b47-a75f-9878-2758-35cd43c30c56.png&quot; alt=&quot;スクリーンショット 2014-04-21 19.13.36.png&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;まとめ&quot;&gt;まとめ&lt;/h2&gt;
&lt;p&gt;何もせずに、無心にObjectを突っ込めばいいのです。&lt;br /&gt;
もうJSON.stringify()とか不要なのです。&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;JSON.stringify()&lt;/code&gt;なしで動くのです。&lt;br /&gt;
Content-Typeもいじらなくていいんです。全部やってくれるんです。&lt;br /&gt;
koa、使わない手はないでしょう。&lt;br /&gt;
※動かない場合は、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;app.use(json());&lt;/code&gt;を指定すると動く。（バージョン次第？）&lt;/p&gt;</content><author><name>mzyy94</name></author><category term="Koa" /><category term="Node.js" /><category term="JavaScript" /><summary type="html">koaでRESTなものを作ろうと思ったときにJSONでオブジェクトを返す必要がでてきました。 いろいろなことが便利になったkoa、JSONを返すコードも素敵に書くことができます。 コード (sample.js)</summary></entry><entry><title type="html">Node.jsでダウンロードしながらGunzipしてmd5の計算しながら保存する奴</title><link href="http://poem.mzyy94.com/items/dl-gunzip-with-nodejs" rel="alternate" type="text/html" title="Node.jsでダウンロードしながらGunzipしてmd5の計算しながら保存する奴" /><published>2014-02-25T13:18:21+00:00</published><updated>2014-02-25T13:18:21+00:00</updated><id>http://poem.mzyy94.com/items/dl-gunzip-with-nodejs</id><content type="html" xml:base="http://poem.mzyy94.com/items/dl-gunzip-with-nodejs">&lt;p&gt;&lt;a href=&quot;http://nodejs.org/&quot;&gt;Node.js&lt;/a&gt;です。&lt;br /&gt;
Lempel-Ziv符号化で圧縮されたファイル(.gz)のダウンロードをしようとしたときの話です。&lt;br /&gt;
ブラウザからダウンロードすると、拡張子gzで保存され、それを解凍することで必要なデータを得ることができるのですが、圧縮されたファイルは解凍したあとでは不要です。&lt;br /&gt;
このような不要ファイルを保存することなく、目的のファイルが欲しいような状況になったので、いろいろと調べて解決しました。&lt;/p&gt;

&lt;!-- more --&gt;

&lt;p&gt;Lempel-Ziv符号化で圧縮されたファイルは、かの有名な&lt;a href=&quot;http://www.zlib.net/&quot;&gt;zlib&lt;/a&gt;によって扱うことができます。&lt;br /&gt;
Node.jsの標準モジュールには、zlibがあり、require()で取り込むことでzlibを利用することができます。&lt;br /&gt;
標準モジュールであるため、APIに関する説明が&lt;a href=&quot;http://nodejs.org/api/zlib.html&quot;&gt;Node.js公式ドキュメント&lt;/a&gt;にあるのですが、よく使い方がわからなかったので、いろいろと試行錯誤してみました。&lt;/p&gt;

&lt;p&gt;結果、zlibモジュールを利用してストリームを扱うオブジェクトを作成し、パイプでつなげることで、前途の目的である、圧縮されたアーカイブファイルを保存することなく、目的のファイルを保存することができました。&lt;/p&gt;

&lt;p&gt;以下、ソースコードになります。&lt;br /&gt;
引数に拡張子gzのファイルのURLを渡し実行することで、解凍されたファイルを保存できます。&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/mzyy94/9209459.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;20行目の&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;res.pipe(gunzip).pipe(output);&lt;/code&gt;にてhttp.getで得られたストリームを&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;zlib.createGunzip()&lt;/code&gt;で作成したgunzipオブジェクトにパイプで渡し、処理されたものを、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fs.createWriteStream()&lt;/code&gt;で作成されたoutputオブジェクトにさらにパイプすることで不要なファイルを保存することなく、ダウンロードしながら解凍し、保存しています。&lt;/p&gt;

&lt;p&gt;保存時に、gunzipオブジェクトの’data’イベントを拾って、crypto標準モジュールでmd5の値を計算させています。&lt;br /&gt;
ダウンロードのときはmd5チェックしたいですし。&lt;/p&gt;

&lt;p&gt;Node.jsのzlibモジュールに関して、あまり実例がなく、せっかくなので記事にしました。&lt;br /&gt;
ご参考になれば幸いです。&lt;/p&gt;</content><author><name>mzyy94</name></author><category term="nodejs" /><category term="zlib" /><category term="gunzip" /><category term="crypto" /><category term="md5" /><category term="http" /><summary type="html">Node.jsです。 Lempel-Ziv符号化で圧縮されたファイル(.gz)のダウンロードをしようとしたときの話です。 ブラウザからダウンロードすると、拡張子gzで保存され、それを解凍することで必要なデータを得ることができるのですが、圧縮されたファイルは解凍したあとでは不要です。 このような不要ファイルを保存することなく、目的のファイルが欲しいような状況になったので、いろいろと調べて解決しました。</summary></entry></feed>