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
| /* | |
| 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 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
| 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
| import React, { useState, useEffect } from 'react'; | |
| import axios from 'axios'; | |
| const fetchData = async (url) => { | |
| try { | |
| const response = await axios.get(url); | |
| return response.data; | |
| } catch (error) { | |
| console.error(error); | |
| return error; |
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 React, { useState, useEffect } from 'react' | |
| import fetchData from './api/fetchData' | |
| const URI = 'https://jsonplaceholder.typicode.com/users' | |
| const Main = props => { | |
| const [data, setData] = useState(null) | |
| useEffect(() => { | |
| const fetchAPI = async () => { | |
| const data = await fetchData(URI) | |
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
| #!/bin/bash | |
| URI='https://shouronbun.com/report1.html' | |
| curl $URI | html2text -utf8 | sed '/^$/d' | sed 's/\*//' | |
| # version3 |
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 seq = (size, start) => [...Array(size)].map((_, i) => i + start) | |
| 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), |