Skip to content

Instantly share code, notes, and snippets.

View hrdyjan1's full-sized avatar
🏠
Working from home

Jan HrdΓ½ hrdyjan1

🏠
Working from home
View GitHub Profile
"$LOCALAPPDATA/Android/Sdk/platform-tools/adb" logcat | grep -iE "react|expo|fatal|error"
<!DOCTYPE html>
<html><head><meta charset="UTF-8"><title>RAGE</title>
<style>*{margin:0;padding:0}body{background:#111;display:flex;align-items:center;justify-content:center;height:100vh}canvas{border:3px solid #444}</style>
</head><body>
<canvas id="c" width="640" height="400"></canvas>
<script>
const cv=document.getElementById('c'),ctx=cv.getContext('2d');
const W=640,H=400,SW=1400;
// depth = screen Y of feet; near=bottom=big, far=top=small
const DMIN=190,DMAX=330;
@hrdyjan1
hrdyjan1 / oboarding.tsx
Last active December 12, 2025 12:40
Anoto
import {
createContext,
useCallback,
useContext,
useEffect,
useMemo,
useRef,
useState,
} from 'react';
import AsyncStorage from '@react-native-async-storage/async-storage';
@hrdyjan1
hrdyjan1 / gist:4c96d63d3adee44deb93eca15a664964
Created September 9, 2025 07:07
react-native-own-katex.tsx
import React, { memo, useMemo, useRef, useState } from 'react';
import { Platform, StyleProp, View, ViewStyle } from 'react-native';
import { WebView, WebViewMessageEvent } from 'react-native-webview';
interface RNKaTeXProps {
math: string;
displayMode?: boolean;
fontSize?: number;
macros?: Record<string, string>;
transparent?: boolean;
@hrdyjan1
hrdyjan1 / app.config.ts
Created April 16, 2025 15:13
Example of app.config.ts wit different android packages.
import {ExpoConfig} from '@expo/config';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore:next-line
const IS_DEV = process.env?.ENVIRONMENT === 'development';
const IS_STAGING = process.env?.ENVIRONMENT === 'staging';
const config: ExpoConfig = {
...,
android: {
@hrdyjan1
hrdyjan1 / useRequestAnimationFrame.ts
Created March 26, 2025 09:28
Custom hook that calls a callback every second using requestAnimationFrame.
import { useEffect, useRef } from 'react';
function useRequestAnimationFrame(isRunning: boolean, callback: () => void) {
const interval = 1000; // 1 second in milliseconds
const startTimeRef = useRef<number | null>(null); // Track the start time
const animationFrameIdRef = useRef<number | null>(null); // Track the animation frame ID
useEffect(() => {
if (!isRunning) {
// If not running, cancel any ongoing animation frame
@hrdyjan1
hrdyjan1 / transcript-text-new.tsx
Created March 10, 2025 12:17
Anoto - New Transcript Text
import 'katex/dist/katex.min.css';
import { memo } from 'react';
import ReactMarkdown from 'react-markdown';
import { ContentRegion } from '~/models';
import Latex from 'react-latex-next';
import { formatTranscriptionsForDisplay, getPageTranscriptionsByFormat } from '~/lib/transcribe/utils';
interface TranscriptTextProps {
contentRegions?: ContentRegion[];
}
@hrdyjan1
hrdyjan1 / useDebounceCallback.ts
Created January 16, 2024 11:16
React solution use debounce
import {useCallback, useRef} from 'react';
type BaseFunction = (...args: any[]) => any;
/**
* Custom hook for creating a debounced callback function.
*
* @param {BaseFunction} callback - The callback function to be debounced.
* @param {number} delay - The delay in milliseconds for the debounce.
*
@hrdyjan1
hrdyjan1 / businessCaseListResponse.ts
Last active November 14, 2023 16:17
CarAudti - businessCases - response
// CarAudit - Mobile App
// 14.11.2023
//
// πŸ“πŸ“„ BusinessCases
// Swagger endpoint info: https://api.dev.teasdev.com/car-audit/v1/doc/datagridV5#/default/data
// Endpoint url like: https://api.stage.omnetic.dev/dms/v5/data-grid/business-case/data
enum BusinessCaseStateKey {
CONCEPT = 'CONCEPT',
OFFER = 'OFFER',
@hrdyjan1
hrdyjan1 / vehicleListResponse.ts
Last active November 14, 2023 16:19
CarAudit - vehicles - response
// CarAudit - Mobile App
// 14.11.2023
//
// πŸš—πŸš• Vehicles
// Swagger endpoint info: https://api.dev.teasdev.com/car-audit/v1/doc/app#/Vehicle/vehiclesV6
// Endpoint url like: https://api.dev.omnetic.dev/car-audit/v6/vehicles?offset=${number}&limit={number}&branchId={string}&custom={VehicleListingFilter}
enum VehicleListingFilter {
ALL = 'all',
MY_CARS = 'myCars',