Skip to content

Instantly share code, notes, and snippets.

View omas-public's full-sized avatar

Omas Naohiko omas-public

View GitHub Profile
const createInfo = (start, max) => {
const threads = GmailApp.getInboxThreads(start, max)
const matrix = threads.map(v => (
[
v.getId(),
v.getFirstMessageSubject(),
v.getMessageCount()
]
))
return matrix
#!/bin/sh
VERSION='90'
TUTOR_DIR="/usr/share/vim/vim$VERSION/tutor"
TUTOR_JA=$(tempfile -p 'ja')
TUTOR=$(tempfile -p 'en')
chmod +w $TUTOR
cp $TUTOR_DIR/tutor.ja.utf-8 $TUTOR_JA
cp $TUTOR_DIR/tutor $TUTOR

JangKeng App

コンピュータとじゃんけんするゲーム

  • プレイヤーは手を選択
  • コンピュータはランダムで手を選択
  • 勝敗を判定して表示

Step 1 [インターフェース表示まで]

import React, { useState, useEffect } from 'react'
const ViewForm = ({ text }) => <p>text: {text}</p>
const ActionForm = ({ fn }) => {
const [inputValue, setInputValue] = useState('')
const handleChange = (e) => {
setInputValue(e.target.value)
}
const handleClick = e => fn(inputValue)
import React, { useState, useEffect } from "react";
import axios from "axios";
const todoDataUrl = "http://localhost:3100/todos";
function App() {
const [todoList, setTodoList] = useState([]);
useEffect(() => {
const fetchData = async () => {
import { useState, useEffect } from 'react'
const Clock = props => {
const [date, setDate] = useState(props.date)
const tick = () => setDate(new Date())
useEffect(() => {
const timerID = setInterval(tick, 1000)
return () => clearInterval(timerID)
}, [])
return (
<div>
import { useEffect, useState } from 'react'
const SampleList = ({ values }) => (
<ul>
{
values.map(({ id, item }) =>
<li key={id}>{item}</li>
)
}
</ul>
import { useState } from 'react'
const FormView = ({ count }) => (
<p>{count}</p>
)
const ActionView = ({ handleClick }) => (
<button
onClick={handleClick}
>
count up
</button>
import React, { useState } from 'react'
import './App.css'
const VueForm = ({ checkedValue }) => (
<p>
現在選択されている値:<b>{checkedValue}</b>
</p>)
const RadioBtnItems = ({ handleChange, checkedValue, values }) => (
values.map(v =>