$ mkdir my-hubot
$ cd my-hubot
$ yo hubot
- 色々聞かれる
- 基本的には初期値のままenter
| var opener = require('opener'); | |
| var result = opener('http://www.example.com/'); | |
| console.log(result.spawnfile, result.exitCode); | |
| setTimeout(()=>console.log(result.spawnfile, result.exitCode),1000); |
| // fetch | |
| URL url = new URL("https://www.wikipedia.org/"); | |
| HttpURLConnection connection = (HttpURLConnection) url.openConnection(); | |
| InputStream in; | |
| try { | |
| in = new BufferedInputStream(connection.getInputStream()); | |
| } finally { | |
| connection.disconnect(); | |
| } |
| { | |
| "private": "true", | |
| "scripts": { | |
| "js": "browserify -t [ babelify --presets [ es2015 ] ] src/main.js -o out/main.js", | |
| "start": "watchify -v -t [ babelify --presets [ es2015 ] ] src/main.js -o 'exorcist out/main.js.map > out/main.js' -d" | |
| }, | |
| "dependencies": { | |
| "babel-preset-es2015": "^6.22.0", | |
| "babelify": "^7.3.0", | |
| "browserify": "^14.1.0", |
To start:
主に4種類あって、
| { | |
| replaceWords(/猫/g, '犬'); | |
| function replaceWords(target, result) { | |
| const texts = []; | |
| const els = document.querySelectorAll('title, body *:not(script):not(style)') | |
| els.forEach(el => { | |
| texts.push(...findTextNodes(el)) | |
| }) | |
| <!DOCTYPE html> | |
| <title>Hello World!</title> | |
| <button id="hello">Hello</button> | |
| <script> | |
| hello.onclick = () => alert('Hello World!'); | |
| </script> |