This file contains 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 numpy as np | |
import sounddevice as sd | |
samplerate = 44100 | |
frequency = 440.0 | |
amplitude = 0.6 | |
sd.default.samplerate = samplerate | |
sd.default.device = 'MacBook Proのスピーカー' |
This file contains 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
useEffect(() => { | |
// 500ミリ秒後にvalidationを動かす | |
// キーストロークのたびにsetFormIsValidが呼ばれなくなる(debounce throttle) | |
// validationは軽い処理だからいいが、バックエンドにデータを送ってvalidationするような重い処理の場合に有効 | |
const identifier = setTimeout(() => { | |
setFormIsValid( | |
enteredEmail.includes('@') && enteredPassword.trim().length > 6 | |
); | |
}, 500); |
This file contains 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, { useEffect, useState } from 'react'; | |
import Button from '../UI/Button/Button'; | |
import Card from '../UI/Card/Card'; | |
import classes from './Login.module.css'; | |
const Login = (props) => { | |
const [enteredEmail, setEnteredEmail] = useState(''); | |
const [emailIsValid, setEmailIsValid] = useState(); | |
const [enteredPassword, setEnteredPassword] = useState(''); | |
const [passwordIsValid, setPasswordIsValid] = useState(); |
This file contains 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, { useRef, useState } from 'react'; | |
import Button from '../UI/Button'; | |
import Card from '../UI/Card'; | |
import ErrorModal from '../UI/ErrorModal'; | |
import classes from './AddUser.module.css'; | |
const AddUser = (props) => { | |
const nameInputRef = useRef(); | |
const ageInputRef = useRef(); |
This file contains 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
<form onSubmit={formSubmitHandler}> | |
<div className={`form-control ${!isValid ? 'invalid' : ''}`}> | |
<label>Course Goal</label> | |
<input type='text' onChange={goalInputChangeHandler} /> | |
</div> | |
<Button type='submit'>Add Goal</Button> | |
</form> |
This file contains 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 { purple, red } from '@mui/material/colors'; | |
import { createTheme, ThemeProvider } from '@mui/material/styles'; | |
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; | |
import Layout from './components/Layout'; | |
import Create from './pages/Create'; | |
import Notes from './pages/Notes'; | |
const theme = createTheme({ | |
palette: { | |
primary: red, |
This file contains 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 { purple } from "@mui/material/colors"; | |
import { createTheme, ThemeProvider } from "@mui/material/styles"; | |
import { BrowserRouter as Router, Route, Switch } from "react-router-dom"; | |
import Create from "./pages/Create"; | |
import Notes from "./pages/Notes"; | |
const theme = createTheme({ | |
palette: { | |
primary: { | |
main: "#fefefe", |
This file contains 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 from "react"; | |
import logo from "./logo.svg"; | |
import "./App.css"; | |
import Button from "@mui/material/Button"; | |
import ButtonGroup from "@mui/material/ButtonGroup"; | |
import SaveIcon from "@mui/icons-material/Save"; | |
import DeleteIcon from "@mui/icons-material/Delete"; | |
import Checkbox from "@mui/material/Checkbox"; | |
import FormControlLabel from "@mui/material/FormControlLabel"; | |
import TextField from "@mui/material/TextField"; |
This file contains 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 matplotlib.pyplot as plt | |
import seaborn as sns | |
import numpy as np | |
sns.set(style='darkgrid') | |
sns.set(font_scale=1.5) | |
plt.rcParams['figure.figsize'] = (10, 5) | |
token_lengths = [len(token) for token in tokenizer.vocab.keys()] |