using embassy
git clone https://github.com/embassy-rs/embassy.git
&cd embassy/examples/rp
- edit the
.cargo/config.toml
file and replace runner line with this:runner = "elf2uf2-rs -d"
cargo run --bin wifi_blinky --release
import { useEffect, useRef } from 'react'; | |
export const useOnlyCallOnce = (cb, condition = true) => { | |
const isCalledRef = useRef(false); | |
useEffect(() => { | |
if (condition && !isCalledRef.current) { | |
isCalledRef.current = true; | |
cb(); | |
} |
using embassy
git clone https://github.com/embassy-rs/embassy.git
& cd embassy/examples/rp
.cargo/config.toml
file and replace runner line with this: runner = "elf2uf2-rs -d"
cargo run --bin wifi_blinky --release
import { useEffect, useState } from "react" | |
export const useWindowSize = () => { | |
const [size, setSize] = useState({ vh: 0, vw: 0 }) | |
const onResize = (props: any) => | |
setSize({ | |
vh: props.target.innerHeight, | |
vw: props.target.innerWidth | |
}) |
/* Hide scrollbar with class .hide-scroll */ | |
/* for Chrome, Safari and Opera */ | |
.hide-scroll::-webkit-scrollbar { | |
display: none; | |
/* Hide scrollbar for IE, Edge and Firefox */ | |
-ms-overflow-style: none; /* IE and Edge */ | |
scrollbar-width: none; /* Firefox */ | |
} | |
/* Always show scrollbar with class .always-show-scroll */ |
import dayjs from "dayjs" | |
import { useEffect, useState } from "react" | |
import { Text } from "react-native" | |
// NOTE: | |
// show max 59:59 time remaining | |
// show 00:00 when time is expired | |
export const RemainingTime = ({ expired_time }: { expired_time: string }) => { | |
const [time, setTime] = useState("00:00") |
{
"folders": [
"use client" | |
import { WithSidebar } from "@/components/with-sidebar" | |
export const Dashboard = () => { | |
return ( | |
<WithSidebar | |
sidebarContent={SidebarContent} | |
mobileDashboardHeader={CustomHeader}> | |
<div className="p-10"> |
export const getPercentageInHex = (percentage: number): string => { | |
if (percentage >= 0 && percentage <= 100) { | |
const preHexNumber = (percentage * 255) / 100; | |
const hexNumber = preHexNumber.toString(16).split('.')[0].padStart(2, '0').replace('f0', 'ff'); | |
return hexNumber; | |
} | |
return 'ff'; | |
}; |
import { useEffect, useRef, useState } from "react"; | |
export const useGetDivDimensions = () => { | |
const [dimensions, setDimensions] = useState({ height: 0, width: 0 }); | |
const div_ref = useRef<HTMLDivElement | null>(null); | |
useEffect(() => { | |
const resizeObserver = new ResizeObserver((event) => { | |
setDimensions({ |
import { TouchableOpacity, View } from 'react-native'; | |
import { withLightHapticFeedback } from '_utils'; | |
import { C_Text } from './C_Text'; | |
const weekdays = ['L', 'M', 'X', 'J', 'V', 'S', 'D']; | |
export const WeekdaysSelector = ({ | |
selectedDays, |