Skip to content

Instantly share code, notes, and snippets.

View kuc-arc-f's full-sized avatar

Kouji Nakashima kuc-arc-f

View GitHub Profile
@kuc-arc-f
kuc-arc-f / test2.tsx
Created November 28, 2024 09:11
react-router-7, CRUD example
import type { Route } from "./+types/home";
import { Form , useSubmit } from "react-router";
import { useState , useEffect } from "react";
import { z } from "zod";
export function meta({}: Route.MetaArgs) {
return [
{ title: "New React Router App" },
{ name: "description", content: "Welcome to React Router!" },
];
@kuc-arc-f
kuc-arc-f / test1.tsx
Created November 28, 2024 07:42
react-router-7 , example
import type { Route } from "./+types/home";
import { Form , useSubmit } from "react-router";
export function meta({}: Route.MetaArgs) {
return [
{ title: "New React Router App" },
{ name: "description", content: "Welcome to React Router!" },
];
}
export async function loader({ params }: Route.LoaderArgs) {
@kuc-arc-f
kuc-arc-f / Dockerfile
Last active November 19, 2024 23:28
docker-bun-postgres
FROM debian
RUN apt-get update && apt-get install -y \
zip \
unzip \
curl
WORKDIR /work
@kuc-arc-f
kuc-arc-f / Api_gemini_addtodo_1018.ts
Created October 19, 2024 06:42
Api_gemini_addtodo_1018
import { Client } from 'pg';
interface Todo {
id?: string;
title: string;
content: string;
userId: number;
completed: number;
createdAt?: Date;
updatedAt?: Date;
@kuc-arc-f
kuc-arc-f / Api_claude_addtodo_1018.ts
Created October 19, 2024 06:41
Api_claude_addtodo_1018
import { Pool } from 'pg';
// PostgreSQLの接続設定
const pool = new Pool({
user: 'your_username',
host: 'localhost',
database: 'your_database',
password: 'your_password',
port: 5432,
});
@kuc-arc-f
kuc-arc-f / Api_chatgpt_addTodo_1018.ts
Created October 19, 2024 06:39
Api_chatgpt_addTodo_1018
import { Pool } from 'pg';
// PostgreSQLの接続設定
const pool = new Pool({
user: 'your_db_user',
host: 'localhost', // データベースホスト(例: localhost)
database: 'your_db_name',
password: 'your_db_password',
port: 5432, // PostgreSQLのデフォルトポート
});
@kuc-arc-f
kuc-arc-f / index.html
Created October 11, 2024 05:41
Server-Sent Events, Express.js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SSE Example</title>
</head>
<body>
<h1>Server-Sent Events (SSE)</h1>
<div id="messages"></div>
@kuc-arc-f
kuc-arc-f / test2pub.ts
Created October 5, 2024 02:03
nodemailer , send example
import nodemailer from 'nodemailer';
const GOOGLE_MAIL_USER = "[email protected]";
const GOOGLE_MAIL_PASSWORD = "123";
const TO_MAIL= "[email protected]";
//
async function sendMail() {
// SMTPトランスポートの設定
const transporter = nodemailer.createTransport({
service: 'gmail',
@kuc-arc-f
kuc-arc-f / Test2.tsx
Created June 13, 2024 12:07
Remix + mermaid.js sample
import type { MetaFunction } from "@remix-run/node";
import React, { useEffect, useRef } from 'react';
import mermaid from 'mermaid';
//
type Props = {
src: string;
className?: string;
};
//
export function Mermaid({ src, className }: Props) {
@kuc-arc-f
kuc-arc-f / dialog5a.html
Last active May 15, 2024 10:38
dialog tag + tailwindcss, sample
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Your Page</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-gray-100">
<div class="container mx-auto my-2 px-8 py-8">