Skip to content

Instantly share code, notes, and snippets.

View hujuu's full-sized avatar
🌊
big wave

hujuu hujuu

🌊
big wave
  • Tokyo
  • 13:18 (UTC +09:00)
  • X @hujuu
View GitHub Profile
@hujuu
hujuu / d268.kt
Created March 20, 2024 02:30
D268_kotlin
fun main(args: Array<String>) {
val num1 = readLine()!!.toInt()
val num2 = readLine()!!.toInt()
val num3 = readLine()!!.toInt()
val result = num1 - num2 - num3
println("$result")
}
@hujuu
hujuu / d275.kt
Created March 20, 2024 02:22
D275_kotlin
fun main(args: Array<String>) {
val num1 = readLine()!!.toInt()
val num2 = readLine()!!.toInt()
// 読み込んだ数値を掛け算して結果を表示
val result = num1 + num2
println("$result")
}
@hujuu
hujuu / d265.kt
Created March 20, 2024 02:12
D265_kotlin
fun main(args: Array<String>) {
val num1 = readLine()!!.toInt()
val num2 = readLine()!!.toInt()
// 読み込んだ数値を掛け算して結果を表示
val result = num1 * num2 * 3
println("$result")
}
@hujuu
hujuu / inputFocusTooltip.tsx
Created February 20, 2024 10:12
フォーカス時にツールチップを出す(案1)
import React, { useEffect, useRef, useState } from 'react';
import { useFloating } from '@floating-ui/react';
const TooltipInput = () => {
const [isFocused, setIsFocused] = useState(false);
const referenceElement = useRef(null);
const popperElement = useRef(null);
const { update } = useFloating();
useEffect(() => {
import { getSession, withApiAuthRequired } from '@auth0/nextjs-auth0';
import { NextResponse } from 'next/server';
const GET = withApiAuthRequired(async () => {
const session = await getSession();
return NextResponse.json(session?.user);
});
export { GET };
@hujuu
hujuu / swr-search-input.tsx
Created March 14, 2023 09:32
swrでテキストインプットのリアルタイム検索
"use client";
import React from "react";
import { useState } from "react";
import useSWR from "swr";
// Add some delay here.
const fetcher = (url: string) =>
Promise.all([
fetch(url),
new Promise((res) => setTimeout(res, 600))
@hujuu
hujuu / victory-boxplot.tsx
Created March 14, 2023 09:25
victoryで箱ひげ図を書く
"use client";
import React from "react";
import { VictoryPie, VictoryChart, VictoryBoxPlot, VictoryTheme } from "victory";
export default function PieChart(){
return (
<VictoryChart
domainPadding={20}
theme={VictoryTheme.grayscale}>
<VictoryBoxPlot
@hujuu
hujuu / tailwind-ribbon-simple.tsx
Created March 14, 2023 09:16
tailswindcssでリボン表示。
export default function Ribbon() {
return (
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2 p-7">
<div
className="relative flex items-center overflow-hidden space-x-3 rounded-lg border border-gray-300 bg-white px-6 py-5 shadow-sm focus-within:ring-2 focus-within:ring-indigo-500 focus-within:ring-offset-2 hover:border-gray-400 after:block after:absolute after:content-[''] after:border-l-[65px] after:border-l-transparent after:border-b-[65px] after:border-gray-500 after:bottom-0 after:right-0"
>
<div className="absolute block text-gray-200 text-xs bottom-2 right-2 z-10">既読</div>
<div className="flex-shrink-0 py-6">
<img className="h-10 w-10 rounded-full"
@hujuu
hujuu / nextjs-react-select.tsx
Created March 14, 2023 08:42
react-selectのサンプル
'use client';
import {useState} from "react";
import Select from "react-select";
const options = [
{value: "line", label: "折れ線グラフ"},
{value: "bar", label: "棒グラフ"},
{value: "pie", label: "円グラフ"},
];
@hujuu
hujuu / CustomSearchBox.tsx
Created January 5, 2023 06:40
algoliaのカスタムサーチボックス
import React from "react";
import { useSearchBox } from "react-instantsearch-hooks-web";
export function CustomSearchBox({ props }: { props: any }) {
const { query, refine } = useSearchBox(props);
return (
<>
<input
type="text"