You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
https://github.com/shibukawa/spawn-limit https://www.npmjs.com/package/spawn-limit spawn-limit というモジュールを作りました。node.jsのchild_process.spawn()の薄いラッパーで、通常のspawnはChildProcessオブジェクトを返して、そいつに色々イベント登録して・・・という使い方をするんですが、プロセスを起動したらthenが呼ばれるPromiseを返すモジュールです。 ブラウザでサーバ間通信のコールバックの管理をPromiseでやるのは問題になることはないと思います。ネイティブのレイヤーで同時通信数を絞ってくれるので、アプリレイヤーで細かいことを考える必要はないでしょう。 今回はnode.jsで外部プロセスを起動しまくるコードを書いたら、プロセス数制限に引っかかって
Photo by Flickr: slworking2's Photostream 既にJavaやPHPなどオブジェクト指向言語を生業としてやっているが、その感覚でJavaScriptを少し扱っているて、いまいちJavaScript分からないという方を対象に、それらのプログラム言語とは違う、「少し独特なJavaScriptのオブジェクト指向」について説明します。 目次 オブジェクトの作成 プロパティの定義と代入 プロパティの削除 アクセサプロパティ(getter / setter) クラス定義 コンストラクタ引数 インスタンスメソッドの定義 クラスプロパティとクラスメソッドの定義 クラスの継承 クラスプロパティとクラスメソッドの継承 1. オブジェクトの作成大かっこ({})でObjectクラスを作成することができます。 また、new演算子で特定のオブジェクトを作成することができます。 //
(window.innerHeight * 0.02)) { this.headerClass = 'header--frosted'; if(window.location.pathname == '/') { this.bannerVideo = false; this.headerClass = 'header--frosted'; this.showNotice = false; } } else { this.headerClass = 'nope'; if(window.location.pathname == '/') { this.bannerVideo = true; this.headerClass = 'header--overvideo'; this.showNotice = true; } else { this.bannerVideo = false; this
実験環境は Chrome Canary 43.0.2314.0 だけど動かしてる分は現時点の安定版(40)でも動くはず やりたいこと http://localhost:3000/api/* へのリクエストを全部serviceworkerに任せたい。 先行実装として Jxck/response-injection がある。 やり方 sw.js(になるsw.coffee) console.log 'worker started' self.onfetch = (event) -> console.log 'onfetch', event.request.url if event.request.url.indexOf(location.origin+'/api') > -1 event.respondWith new Response '{"foo": "bar"}', status: 200
Not everybody knows that apart from the simplest console.log() used for logging, the Console object has a couple of other equally useful function. I have chosen and described the 5 most interesting but unpopular methods, which can be successfully utilized in everyday work. All of the functions described have been tested and work properly in Google Chrome 38 console.assert(expression, message) If t
十一章第三回 consoleこのページの最終更新日:2017年9月14日 今回紹介するのはconsoleです(実はES5の範疇ではないような気がしますが気にしないでください)。これはデバッグ時に大いに役立つものです。 consoleと言われたら、二章第一回に紹介して以来ずっと使ってきたconsole.logを思い浮かべますね。 実はconsole.logの他にも似たような便利メソッドがあるので、今回はそれを紹介します。 console.logというのも、実はconsoleという変数に入ったオブジェクトが持つlogというメソッドであることはお察しのとおりです。 console.debug, console.info, console.warn, console.errorやはりconsoleで一番使うのはconsole.logで、それ以外のメソッドは使用頻度が結構劣ります。デバッグ用の用途が
Rails 4.2から導入されたweb-consoleについて試してみたのでメモ。なお、試したバージョンは'2.0.0.beta3'。Rails 4.2.beta1だと、2.0.0.beta2がGemfileに記載されているが、2.0.0.beta2はルーティングエラー時にエラーになるバグがあるのでbeta3で。 ### web-consoleとは Rails 4.2のMajor Featuresの一つ。 デフォルトエラーページ用のデバッギングツールで、ブラウザ上からインタラクティブにconsoleの操作が出来る。 [github上の画像引用](https://github.com/rails/web-console)。 エラーが起きた箇所で操作が出来るだけではなく、traceを選択する事で、選択した箇所での値の確認も出来る。[Better Errors](https://github.c
git-ignore add みたいのが欲しい— azu (@azu_re) August 24, 2014 ちょろっと書けそうだったので書いた。 yuroyoro/git-ignore · GitHub Demo Installation PATH通った場所においてくれ curl -sL https://raw.githubusercontent.com/yuroyoro/git-ignore/master/git-ignore > ~/bin/git-ignore Examples `git ignore add "pattern"`で、.gitignoreへ追加する。 $ git ignore add '*.log' .gitignoreから削除するには、`git ignore remove "pattern"`を実行する。 $ git ignore remove '*.log' a
追記:冷静になるとこの記事なんか変なので、あとで修正します。参照しないように。 forやめろ -- LL Diver 2014 LT枠 forを使わないループ、簡単な例はみんな思いつくからいいとして、一番ややこしいやつ考えてたんだけど、やっぱり無駄にPromise酷使する例だと思った。 追記:この例はちょっとミスってた。正しいコードを末尾に載せる CoffeeScript # Serialized Sync Promise [1..100] .map (i) -> new Promise (d) -> console.log i; d() .reduce ((l, p) -> l.then p), Promise.resolve() JavaScript (function() { _results = []; for (_i = 1; _i <= 100; _i++){ _results
One often overlooked feature of node.js is the ability to create command-line utilities. Here I want to demonstrate how simple it can be to create useful command-line utilities with the help of node.js. I’m going to create a small utility which allows for quick searching of GitHub for reposities based on keywords, owners and languages. If you’d like to jump straight into the source code, it’s avai
After I prototype an app I'm building, my time is split between the editor and the browser with the console open. I try to debug as I go to avoid creating a complete mess. Moreover, when I get a bug report for a production app the first thing that I do is try to debug using Chrome devtools, and I usually find the bug without touching my editor. To be effective at that, I had to learn a great deal
Git for Windows の Git Bash の配色がイマイチだなーと思ってググってたら、Console2 だとか ConEmu を使うと楽にできるっぽいことが、Stack Overflow とか英語のブログで見つかった。 そこで、ConEmu を試してみたら色々と幸せになった (Console2 はそのままでは日本語が使えなかった。解決方法はあるらしいけど…)。 左が Git Bash、右が ConEmu さん。 アンチエイリアス効いてるし、色もオサレ。 起動から色を設定するまで ConEmu を起動すると、初回は設定の保存場所などを確認される。お好みで答えて [OK] を押すと、タブ化した MS-DOS プロンプトみたいなのが立ち上がってくる。 [Win] + [N] を押すと新しいタブを開始できる。 上のキャプチャーのように、どんな環境のタブを開始するかをメニューで聞いてきて
One of my favorite things about programming in node is the package management system. In almost all instances, the practice of locally installing modules for each project has simplified my life as a developer. However, as a long time contributor to Grunt, I have become intimately familiar with one edge case where this practice breaks down. In the hope of mitigating the annoyance for everyone, I cr
この記事は主にConsole2の紹介とnyoasのLua拡張についての話です。 Windowsのコマンドプロンプトはとても使いづらいので、コマンドプロンプト代替ツールとしてckwと拡張性が優れたNYAOS(昔はnyacus)などのシェルを合わせて使ってる人もいると思います。 自分も少し前まではckw-mod+NYAOSを使っていました。 【DOS窓】NYAOS CKW+α【便利化】-奈良北部のなにか 現在はタイトル通りConsole2+NYAOSにしています。 ckwやConsole2はターミナルに該当するソフトウェアで、nyaosやgitbashなどはシェルに該当するソフトウェアです。 NYAOS はターミナルではない!シェル! Console2でnyaosを使うのは簡単で、Settings>ConsoleのShell(またはタブ毎の設定)にnyoas.exeのパスを入れるだけで完了です
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く