import { useEffect, useState } from "react"
import ulid from 'ulid'
import axios from 'axios'
// const Item = ({ item, role }) => (
// )
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
| import axios from "axios"; | |
| import { useState, useEffect } from "react"; | |
| const baseURL = "https://jsonplaceholder.typicode.com/users/1"; | |
| const print = JSON.stringify | |
| const Item = ({ user }) => ( | |
| <li>{user}</li> | |
| ) |
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
| const handler = (req, res) => { | |
| const json = { | |
| headings: [ | |
| '日付', | |
| '項目', | |
| '入金', | |
| '出金' | |
| ], | |
| values: [ | |
| { |
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
| /* | |
| Baseとなるjsx | |
| */ | |
| const MoneyBook = props => { | |
| return ( | |
| <> | |
| <h1>お小遣い帳</h1> | |
| <table> | |
| <thead> |
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
| const identity = v => v | |
| const join = (sep = '\n') => array => array.join(sep) | |
| const split = (sep = ' ') => string => string.split(sep) | |
| const inputs = (file = '/dev/stdin') => { | |
| const stream = require('fs').readFileSync(file, 'utf-8').trim() | |
| const toArray = sep => fn => iter => Array.from(split(sep)(iter), fn) | |
| return { | |
| readCols: (fn = identity) => toArray(' ')(fn)(stream), | |
| readRows: (fn = identity) => toArray('\n')(fn)(stream), | |
| readStream: (fn = identity) => fn(stream), |
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
| const fileSync = file => { | |
| const stream = require('fs').readFileSync(file, 'utf8').trim() | |
| console.log(stream) | |
| return stream | |
| } | |
| const fileAsync = file => { | |
| const callback = (error, data) => data | |
| const stream = require('fs').readFile(file, 'utf8', | |
| callback |
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
| const fun = array => n => array.map(v => v * n) | |
| const array = [1, 2, 3] | |
| console.log(JSON.stringify(array.map(v => fun(array)(v)))) |
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
| // 1114.js | |
| const arr = [0, 1, 12, 24, 36] | |
| const start = 2 | |
| const f1 = (arr, start) => { | |
| const head = arr.slice(0, 2) | |
| const tail = arr.slice(start + 2) | |
| return [...head, 16, 25, ...tail] | |
| } |
標準入力は以下を使用
const stream = require('fs').readFileSync('/dev/stdin', 'utf8').trim()
// const cols = stream.split(' ')
// const lines = stream.split('\n')
// const matrix = stream.split('\n').map(line => line.split(' '))入力は以下のテンプレートを使用する
const stream = require('fs').readFileSync('/dev/stdin', 'utf8').trim()
const lines = stream.split('\n')