Skip to content

Instantly share code, notes, and snippets.

View nashdev255's full-sized avatar
💪

Tomo Ogasawara nashdev255

💪
View GitHub Profile
@nashdev255
nashdev255 / creative-engineering-s1-bletest.ino
Last active September 30, 2025 18:22
arduino-esp32を使用してXIAO_ESP32C3でBLE通信を行う
#include <BLEDevice.h>
#include <BLEServer.h>
#include <BLEUtils.h>
#include <Arduino.h>
// データシート : https://files.seeedstudio.com/wiki/XIAO_WiFi/Resources/esp32-c3_datasheet.pdf
constexpr int M1 = 32, M2 = 33, M3 = 27;
constexpr int pwmPin1 = 25, pwmPin2 = 26, pwmPin3 = 14;
constexpr int pwmChannel1 = 0, pwmChannel2 = 1, pwmChannel3 = 2;
@nashdev255
nashdev255 / SvgButton.tsx
Last active July 12, 2025 00:50
SVGをボタンとして扱う時に、透過部分をクリック不可領域とするReactコンポーネント
'use client';
import { useEffect, useState, useRef } from "react";
type SvgButtonProps = {
src: string;
className?: string;
onClick?: () => void;
};
const SvgButton = ({ src, className, onClick }: SvgButtonProps) => {
@nashdev255
nashdev255 / Monsters.tsx
Created October 18, 2024 02:46
GitHubから画像データをフェッチする
const [imageList, setImageList] = useState<Monster[]>([]);
const [message, setMessage] = useState<string | null>(null);
useEffect(() => {
(async () => {
try {
const res = await fetch(
'https://api.github.com/repos/Krostar5793/itky-quest/contents/dot-works',
{
method: 'GET',
@nashdev255
nashdev255 / build.gradle.kts (Module)
Last active September 3, 2024 03:40
Roomを使用したデータベース環境構築の手順
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.jetbrains.kotlin.android)
+ alias(libs.plugins.ksp.gradle.plugin)
+ alias(libs.plugins.compose.compiler)
}
android {
namespace = "com.example.roomenvsetup"
compileSdk = 34
@nashdev255
nashdev255 / Icons.kt
Last active August 22, 2024 03:42
Jetpack Compose で Google Fonts の Material Symbols & Icons を導入する
@Composable
fun HistoryIcon(iconColor: Color, iconSize: Dp) {
Icon(
painter = painterResource(id = R.drawable.history_icon),
contentDescription = "History icon",
tint = iconColor,
modifier = Modifier.size(iconSize)
)
}
@nashdev255
nashdev255 / TitleScreen.kt
Created August 22, 2024 02:27
Jetpack Compose で背景画像を追加する
@Composable
fun TitleScreenBackgroundImage() {
Box(modifier = Modifier.fillMaxSize()) {
Image(
\*
res/drawable/配下にtitle_screen_background_image.pngを追加
(ファイル名には大文字など使ってはならない文字があるので注意)
*\
painter = painterResource(id = R.drawable.title_screen_background_image),
contentDescription = "Title screen background image",
@nashdev255
nashdev255 / AndroidManifest.xml
Last active August 22, 2024 02:21
Android Studio で画面の向きを設定する
<activity
android:name=".MainActivity"
android:screenOrientation="landscape" // 横画面設定
android:screenOrientation="portrait" // 縦画面設定
>
</activity>