brew install mongodb
Set up launchctl to auto start mongod
$ ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents
/usr/local/opt/mongodb/
is a symlink to /usr/local/Cellar/mongodb/x.y.z
(e.g., 2.4.9
)
2018 年 6 月の JSConf EU で Deno が初めて発表されてから 1 年が経ちました.
日本では 2018 年 12 月ごろから Deno の周辺で作業をする人が増え, 2019 年 1 月頃から定期的に Deno もくもく会 #deno_ja
が開催されるようになりました.
#deno_ja
では毎回, 冒頭で簡単な自己紹介をするのですが, よくよく聞いていると早く Deno を始めた人でも 12 月ぐらいの人が多いことに気づきました. 自分だけが Deno 公開直後の 5 月からコントリビュートしています. そして, なぜその時期から Deno にコントリビュートしているのか, #deno_ja
の中でも自分からあまり説明できていないことに気がつきました.
この記事は, なぜ自分がそこまで Deno にコントリビュートするのかの理由を出来る限り言語化してみる試みです.
var http = require('http'); | |
var WebSocketServer = require('websocket').server; | |
var port = 8080; | |
process.stdin.resume(); | |
process.stdin.setEncoding('utf8'); | |
var index = '<!DOCTYPE html><html><head><title>stdin-to-ws</title></head>' | |
+ '<body><div id="msg"></div><script>' | |
+ 'var msg = document.getElementById("msg");' | |
+ 'var ws = new WebSocket("ws:localhost:8080/stdin-to-ws", "stdin-to-ws");' |
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
/** | |
* Fancy ID generator that creates 20-character string identifiers with the following properties: | |
* | |
* 1. They're based on timestamp so that they sort *after* any existing ids. | |
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs. | |
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly). | |
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the | |
* latter ones will sort after the former ones. We do this by using the previous random bits | |
* but "incrementing" them by 1 (only in the case of a timestamp collision). | |
*/ |
This example pulls together various examples of work with trees in D3.js.
The panning functionality can certainly be improved in my opinion and I would be thrilled to see better solutions contributed.
One can do all manner of housekeeping or server related calls on the drop event to manage a remote tree dataset for example.
Dragging can be performed on any node other than root (flare). Dropping can be done on any node.
Panning can either be done by dragging an empty part of the SVG around or dragging a node towards an edge.