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
@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',
@hrdyjan1
hrdyjan1 / .eslintrc.js
Created September 11, 2023 10:45
Carvago - Frontend Monorepo - eslint
module.exports = {
settings: {
react: {
version: '18',
},
},
parser: '@typescript-eslint/parser',
extends: [
'plugin:prettier/recommended',
// enable typescript support
@hrdyjan1
hrdyjan1 / index.html
Last active October 18, 2023 05:45
Download PDF
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>PDF upload/download</title>
</head>
<body>
<form>
<label for="pdf-upload">Choose a PDF file to upload:</label>
<input type="file" id="pdf-upload" name="pdf" accept=".pdf" />