Using WSL (Ubuntu) on Windows 10.
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.3 LTS"
const WebSocket = require('ws'); | |
let numClients = 0; | |
// start server | |
// https://github.com/websockets/ws | |
const wss = new WebSocket.Server({ | |
port: 8080, | |
perMessageDeflate: { | |
zlibDeflateOptions: { // See zlib defaults. |
echo == アプリ作成 == | |
rails new uploader | |
cd uploader | |
echo == CarrierWave導入 == | |
echo "gem 'carrierwave'" >> Gemfile | |
bundle | |
echo == 投稿モデル作成 == | |
rails g scaffold post name:string comment:text |
Object.entries(Array.from(document.querySelectorAll('*')) | |
.reduce((list, el) => { | |
const styles = window.getComputedStyle(el); | |
Object.values(styles).forEach((prop) => { | |
const value = styles[prop]; | |
if (prop.toLowerCase().includes('color')) { | |
(value.match(/rgba?\(\d+, \d+, \d+(, \d+(.\d+)?\))?/g) || []) | |
.map(s => (s.match(/\d+(.\d+)?/g) || []).join(', ')) | |
.forEach((color) => { | |
if (!(color in list)) { |
<!DOCTYPE html> | |
<title>Hello World!</title> | |
<button id="hello">Hello</button> | |
<script> | |
hello.onclick = () => alert('Hello World!'); | |
</script> |
{ | |
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)) | |
}) | |
主に4種類あって、
To start:
{ | |
"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", |