This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 更新情報取得 | |
database.ref('list').on('value', (snapshot) => { | |
this.list = getList(snapshot); | |
this.update(); | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>出欠表</title> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width, user-scalable=no" /> | |
<meta name="apple-mobile-web-app-capable" content="yes" /> | |
<link rel="stylesheet" href="./index.css" /> | |
<!-- firebase --> | |
<script src="https://www.gstatic.com/firebasejs/3.6.2/firebase-app.js"></script> | |
<script src="https://www.gstatic.com/firebasejs/3.6.2/firebase-database.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
database.ref('list').once('value').then((snapshot) => { | |
const list = getList(snapshot); | |
riot.mount('List', { list }); | |
riot.mount('Add'); | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[...Array(4)].reduce((l, c, i, a) => i + 1 === a.length ? l.replace(/\$\{(L|R)\}/g, '') : l.replace(/\}/g, '#}').replace(/\$\{L#\}/g, 'L${R}FR${L}F${L}RF${R}L').replace(/\$\{R#\}/g, 'R${L}FL${R}F${R}LF${L}R'),'L${R}FR${L}F${L}RF${R}L').split("F").slice(0, -1).reduce(({ x, y, ctx, dir }, LR, i) => Object.assign({},{ d : dir = LR.split("").map((lr) => lr === "L" ? 1 : -1).reduce((dir, lr) => (dir + 90 * lr) >= 360 ? 0 : (dir + 90 * lr) < 0 ? 360 + (dir + 90 * lr) : (dir + 90 * lr) , dir), dir }, { xx: dir === 90 ? x += 10 : dir === 270 ? x -= 10 : x, yy: dir === 0 ? y += 10 : dir === 180 ? y -= 10 : y, },{ l: setTimeout( () => { ctx.lineTo(x, y),ctx.stroke() }, i * 10) }, { x, y, ctx, dir }), { x: 10, y: 10, dir: 0, c:[ctx = canvas.getContext('2d'), ctx.beginPath(), ctx.moveTo(10, 10)] , ctx}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 一行 | |
((FizzBuzzArr = ["Fizz", "Buzz", "FizzBuzz"], digit = 3) =>[...Array(digit)].reduce((pV, cV, n) =>[...pV,...Array(FizzBuzzArr.length ** n + 1).fill([...Array(n + 1)]).map((arr, index) =>arr.map((v, i) =>FizzBuzzArr[parseInt(index / FizzBuzzArr.length ** i) % FizzBuzzArr.length]))],[]).map((fizzbuzz) =>Object.assign({fizzbuzz,answer: ((target = [...Array((fizzbuzz.filter((fb) => fb === FizzBuzzArr[2]).length + 1) * 15)] .map((v, i) => !((i + 1) % 15) ? FizzBuzzArr[2] : !((i + 1) % 5) ? FizzBuzzArr[1] : !((i + 1) % 3) ? FizzBuzzArr[0] : "" ) .map((v, i, a) => v !== fizzbuzz[0] ? [] : a.slice(i).reduce((arr, v) => arr.filter((v) => !!v).join("/") === fizzbuzz.join("/") ? arr : [...arr, v], [] ) ) .map((arr, index) => arr.filter((v) => !!v).join("/").indexOf(fizzbuzz.join("/")) === 0 && arr.filter((v) => !!v).every((v, i) => v === fizzbuzz[i]) ? arr.map((v, i) => i + index + 1) : false )) =>target.some((v) => !!v) ?target.filter((v) => !!v).reduce((pArr, cArr) => !pArr || pArr.length > cArr.length ? cArr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 一行 | |
((L='L${R}FR${L}F${L}RF${R}L',R='R${L}FL${R}F${R}LF${L}R',ctx=canvas.getContext('2d'),len=10)=>[...Array(4)].reduce((p,c,i,a)=>p.replace(/\$\{(L|R)\}/g,i+1===a.length?'':(s)=>s.includes('L')?L:R),L).split("F").map((s)=>!(s.length%2)?0:s.slice(-1)==='L'?1:-1).reduce((a,lr,i)=>[...a,Object({d:(a[i].d+lr)%4<0?3:(a[i].d+lr)%4,x:a[i].x+Math.floor(Math.sin(a[i].d/2*Math.PI))*len,y:a[i].y+Math.floor(Math.sin((a[i].d-1)/2*Math.PI))*(-1*len),})],[{x:len,y:len,d:0}]).forEach(({x,y},i)=>i<2?ctx.moveTo(x,y):new Promise((resolve)=>setTimeout(()=>resolve(ctx.lineTo(x,y)),(i-1)*10)).then(()=>ctx.stroke()))).call(); | |
// 分解 | |
((L = 'L${R}FR${L}F${L}RF${R}L', R = 'R${L}FL${R}F${R}LF${L}R', ctx = canvas.getContext('2d') , len=10 ) => | |
[...Array(4)].reduce( | |
(p, c , i, a) => | |
p.replace(/\$\{(L|R)\}/g, i + 1 === a.length ? '' : (s) => s.includes('L') ? L : R) | |
, L).split("F") | |
.map((s) => !(s.length % 2) ? 0 : s.slice(-1) === 'L' ? 1 : -1 ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<canvas id=canvas width="2000px" height="2000px"></canvas> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
フルエ田山田エルフ | |
田田田 | |
エ エ エ | |
ル ル ル | |
フ フ フ | |
*/ | |
((string = '山田エルフ') => string.split('').reduce((arr, char, i) => !i ? [[(str) => str.reverse(), (str) => str.slice(1)].reduce((arr, func) => [...arr, ...func(string.split(''))], [])] : [...arr, arr[0].map((char2) => char2 === char || char2 === string.slice(0, 1) ? char : " ")], []).forEach((str) => console.log(str.join("")))).call() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Q2 | |
require("fs").readFile("./attend", (err, text) => require("fs").readFile("./attend6", (err, text6) => `${text}`.split("\n").filter((v) => !!v).forEach((v) => console.log(`${v}${text6.includes(v.split(" ")[0]) ? "出" : "欠"}`) ))) | |
//Q4.1 | |
console.log("-1 4 5 2 42 421 44 311 -9 -11".split(" ").sort((a,b) => Number(a) > Number(b) ? 1 : -1).map((v,i,a) => `${v} ${ !i || String(a[i+1]).length !== String(v).length ? "\n" : ""}` ).join('')) | |
//Q4.2 | |
console.log("-1 +4 5 2 42 421 44 311 -9 -11".split(" ").sort((a,b) => Number(a) > Number(b) ? 1 : -1).map((v,i,a) => `${v} ${ !i || String(a[i+1]).length !== String(Number(v)).length ? "\n" : ""}` ).join('')) | |
//Q6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// c <= 3 | |
// 一行 | |
((s=0,c=3,len=900,ctx=canvas.getContext('2d'),m=([x,y,l])=>[[x,y,l],[x,y+l,l],[x+l,y+l,l],[x+l,y,l]])=>[...Array(c)].reduce((a,b,i)=>[...a,...((l=a[a.length-1][2]/3,o=[...Array(3**(i+1))].map((v,j)=>!j?l:(3*j+1)*l))=>o.reduce((c,x)=>[...c,...o.map((y)=>[x,y,l])].filter(([x,y],i)=>a.filter((v,i)=>i).map((v)=>m(v)).every((v)=>!(x>v[0][0]&&x<v[2][0]&&y>v[0][1]&&y<v[2][1]))),[])).call()],[[0,0,len],Array(3).fill(len/3)]).map((v)=>m(v)).forEach((c)=>[...c,c[0]].forEach(([x,y],i)=>new Promise((resolve)=>setTimeout(()=>resolve(i<1?ctx.moveTo(x,y):ctx.lineTo(x,y)),++s*10)).then(()=>ctx.stroke())))).call(); | |
//複数行 | |
( | |
(s = 0, c = 3, len = 900, ctx = canvas.getContext('2d'), m = ([x, y, l]) => [[x, y, l], [x, y + l, l], [x + l, y + l, l], [x + l, y, l]]) => | |
[...Array(c)].reduce((a, b, i) => | |
[ |