Help us understand the problem. What is going on with this article?
つい最近、初めて作った Google Chrome エクステンション「Feedly をはてブ対応させる Chrome エクステンション」をブログで紹介したので、その時の技術的なメモなどを Qiita に残しておきたいと思います。まあ検索すればすぐに集まる程度の情報ではあるものの、一箇所にまとまってなかったので、自分用の備忘録でもあります。 全てのソースコードは github 上で公開しているので、気になる方は参考にしてみて下さい。実際に書いたスクリプトの簡単な解説もこの記事の最後に付録として付けています、 超最低限な Chrome エクステンションの作成 Chrome エクステンションは基本的に、一つのフォルダに保存された複数のファイルからなります。エクステンションのルートに必要な最初のファイルは、manifest.json というファイルで、これがエクステンションの基本的な情報を含んでい
はじめに Thetaの360°画像にぼかしを入れるWebアプリSphereBlur.comを作った際に、オフラインでも動くようにするために、HTML5の新しい技術Service Workerを使った。なお、下の動画でホーム画面からネイティブアプリっぽく起動しているのはWeb App Manifestのおかげである。 Service Worker Service Workerは、通常のページの環境とは別に、バックグラウンドで実行されるJavaScript実行環境で、ページからのネットワークリクエストを横取りしたり、ウェブサイトからのPush通知を受けとって表示するといった、今まではできなかった処理をすることができる。Push通知の方は、去年Facebookが使い始めたので有名になったが、今回はPush通知ではなく、ネットワークリクエストを横取りする機能を使ってオフライン対応をした。 ネットワ
Chrome 43およびそれ以降のバージョンにおいて、DOMの属性(値)がJavaScriptのプロトタイプチェーンに移行されます。これにより、突っ込んだことをやっていた場合に、今まで動作していたコードが動かないということが発生する可能性がありますので、事前に変更内容を知り、対策をしておくことが求められます。HTML5Rockの更新情報として掲載されていましたので、さっそく日本語訳をしてみました。心当たりがある方は、ぜひ以下の内容を読んでいただいて、コードの修正などに取り込んでいただければと思います。 原文: http://updates.html5rocks.com/2015/04/DOM-attributes-now-on-the-prototype DOM属性は今後プロトタイプチェーンに Chromeチームは、最近「DOM属性をプロトタイプチェーンに移動しています」とアナウンスしてい
Chromeブラウザ、「Script streaming」と「Code caching」の2つのテクニックで、さらにWebページ読み込み時間を短縮へ Chromium Blogで、「New JavaScript techniques for rapid page loads」(迅速なページロードのための新たなJavaScriptテクニック)というポストが投稿され、Webページのロードをさらに高速化する「Script streaming」と「Code caching」という2つのテクニックが紹介されています。 この2つのテクニックは、最新バージョンとなる41と次のバージョンの42でそれぞれ導入されるとのことです。 別スレッドでのパースにより高速化 「Script streaming」は、async/defer属性が付いたJavaScriptについてはダウンロードと並行して別スレッドでパースを
フロントエンド周りの技術は驚異的なスピードで進化し、また多様化しています。それらを全てマスターするのは途方もなく大変なので、ペパボでは、社内のエンジニア・デザイナが「最低限これだけはおさえておこう」というスタンダードを文書化することにいたしました。社内向けを想定した文書ではありますが、社内のみに留めず多くの方に役立てたいと考えたため公開します。 この項目の担当 @hadashiA どうしてフレームワークを使う? (1) ドメインロジックとプレゼンテーションの分離 (2) SPA(シングルページアプリケーション) 流行り廃り (1) MVC (2) MVVM (3) Virtual DOM どれを使う? どうしてフレームワークを使う? (1) ドメインロジックとプレゼンテーションの分離 まずこちらの画面を見てください。 ©任天堂 スーパーマリオワールド スーパーマリオが右にダッシュすると、マ
7月19日に行った「覚醒!JavaScript」勉強会で使用したスライドです。 http://connpass.com/event/7082/Read less
var oldValue, newValue, diff; oldValue = 67; newValue = 66.9; diff = oldValue - newValue; diff = Math.floor(diff * 10) / 10; // 小数点第2位以下切り捨て console.log("今日は" + diff + "kgやせました!"); ファッ!? 0.1kg痩せたはずが、0kgと表示されてしまいました。 たかだか100gとはいえ、こんな表示になったらガックリきますね。 一行ずつ値を追っていくとわかるのですが、4行目で減算した時点でdiffの値が "0.09999999999999432" とズレてしまっています。 これはJavaScriptがIEEE 754という規格に従って実装されているためです。 つまり、この計算結果はJavaScriptの仕様なのでJavaSc
対象読者 スマートフォンWebサービス開発者 特に、フロントエンド周りの開発に従事する方 スマートフォン向けWebサイト高速化のテクニック スマートフォンはOS/デバイスの進化が激しく、要求される最適化の内容も半年で別物になることがあります。そのため最適化に際しては、案件ごとの状況や目的、デバイス/OSのシェアに応じて、まずターゲット端末を選定し、問題の検出を行います。 この記事では「iPhone 4+iOS 5」を想定して話を進めます。実際に「iPhone 4+iOS 5」はよく現場でも最も動作が重い組み合わせとしてターゲット端末に挙がります。これはiPhone 4がRetinaディスプレイを採用したことで960×460ピクセルの高解像度を備えながら、CPUなどのデバイス性能が潤沢とはいえず、ボトルネックが生まれやすいためです。iOS 4ではなくiOS 5をターゲット端末として扱うのは、
なんかランダムもの続きですが。。 別に僕の中で流行ってるとかそういうわけでもありません^^; たまたま入用だっただけです。 というわけで、指定文字数のランダムな文字列を生成するjsです。 ソース var randobet = function(n, b) { b = b || ''; var a = 'abcdefghijklmnopqrstuvwxyz' + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + '0123456789' + b; a = a.split(''); var s = ''; for (var i = 0; i < n; i++) { s += a[Math.floor(Math.random() * a.length)]; } return s; }; // randobet(10, '-_!'); // 2OM_g0-76n 「randobet(1
はてなグループの終了日を2020年1月31日(金)に決定しました 以下のエントリの通り、今年末を目処にはてなグループを終了予定である旨をお知らせしておりました。 2019年末を目処に、はてなグループの提供を終了する予定です - はてなグループ日記 このたび、正式に終了日を決定いたしましたので、以下の通りご確認ください。 終了日: 2020年1月31日(金) エクスポート希望申請期限:2020年1月31日(金) 終了日以降は、はてなグループの閲覧および投稿は行えません。日記のエクスポートが必要な方は以下の記事にしたがって手続きをしてください。 はてなグループに投稿された日記データのエクスポートについて - はてなグループ日記 ご利用のみなさまにはご迷惑をおかけいたしますが、どうぞよろしくお願いいたします。 2020-06-25 追記 はてなグループ日記のエクスポートデータは2020年2月28
ユーザーがリンクをクリックして、サイト内の存在しないページにアクセスすると、サーバーから 404(ページが見つかりません)エラーが返されます。このような一般的なメッセージはユーザーにとって有用でないため、独自の 404 ページを作成して、サイトに関する役立つ情報を提供することをおすすめします。 また、ウェブマスター ツールの 404 ウィジェットをカスタム 404 ページに追加することができます。404 ウィジェットは、エラー メッセージの代わりに有効なヘルプを自動的に提示します: サイトの検索ボックスと検索の候補を表示します。 間違った URL に対する URL の候補を提示します。 これにより、ユーザーは必要な情報を見つけやすくなるため、別のサイトに移動する可能性が低くなります。 注: 現在のところ、ウィジェットはテスト機能なので、一部のサイトに対しては、最も近い URL や URL
2013年1月26日追記 時代の移り変わりとともに、このソースでは対応できなくなっているので 続:Androidブラウザでviewportのwidth指定[to-R] こちらのやり方がいいと思います! これを横に回転させて、 画面幅に合わせて拡大したい。 これ、見にくくないのかな...と個人的には思うんですが、そういう依頼がちらほら来るのでまとめてみました。 サンプルページ http://sakaki0214.com/sample/110605/ 通常(横にしても拡大しない) <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1" /> iPhone用(横にすると拡大する) <meta name="viewport" content="wid
概要 ▶ 出典:Initializr - Start an HTML5 Boilerplate project in 15 seconds!先日開催された「CSS Nite in NIIGATA, Vol.3 with Microsoft」でせっかくHTML5の事を学んだので、実際に使ってみようと勉強を進めています。このブログも実はPC版は形式上HTML5のページになっているんです。見た目はほとんど変わって 出典:Initializr - Start an HTML5 Boilerplate project in 15 seconds! 先日開催された「CSS Nite in NIIGATA, Vol.3 with Microsoft」でせっかくHTML5の事を学んだので、実際に使ってみようと勉強を進めています。 このブログも実はPC版は形式上HTML5のページになっているんです。 見た目
ただ、WebRTCで顔認識させようとすると遅くてしかたがなかった。 最初は速いこともあるが、10回ぐらい認識をさせるとすぐに遅くなる。 とりあえず、デモ。 そこで、チューニングをしてみることにした。 まず、JavaScriptの定番の高速化を試してみた。 例えば、正の数で使える「Math.floor(x)」を「(x | 0)」に、整数で使える「x * Math.pow(2, y)」を「x << y」にする等。 これで、10~30%高速化できた。 次に、遅くなっている部分を調べたら、Web Workersで分散するための仕組みが遅くなる原因だとわかった。 これは、Web Workersを使わない場合にも影響が出ていた。 じゃあ、Web Workersを使えば速くなるのかといえばその逆で、20倍遅くなっていた。 詳しくは調べてないけど、多分Workerスレッドに処理データを渡す時にJSON化が
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く