Skip to content

Instantly share code, notes, and snippets.

View Steellgold's full-sized avatar
🍓

Gaëtan H Steellgold

🍓
View GitHub Profile
package com.author.appname
import android.content.Intent
import androidx.core.content.FileProvider
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.bridge.ReactContextBaseJavaModule
import com.facebook.react.bridge.ReactMethod
import java.io.File
class ApkInstallerModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
import type { ReactElement } from "react";
import { useState } from "react";
import { Button } from "react-native-paper";
import { useAsync } from "../../hooks/useAsync";
import { APP_VERSION } from "../../../../v";
import { supabase } from "../../db/supabase";
import type { Database } from "../../db/supabase.types";
import RNFetchBlob from "rn-fetch-blob";
import ApkInstallerModule from "../../../../apkinstaller";
import type { Dispatch, ReactElement, SetStateAction } from "react";
export type Component<Props> = (props?: Props) => ReactElement;
export type AsyncComponent<Props> = (props?: Props) => Promise<ReactElement>;
export type NPComponent<> = () => ReactElement;
export type NPAsyncComponent<> = () => Promise<ReactElement>;
export type SetState<T> = Dispatch<SetStateAction<T>>;
@Steellgold
Steellgold / minimize.tsx
Created May 4, 2024 16:13
The function is a React component that displays different text depending on whether the browser window is wider or narrower than 640 pixels, using a responsive design approach.
"use client";
import { ReactElement } from "react";
import { useWindowSize } from "usehooks-ts";
export const Child = (): ReactElement => {
const { width } = useWindowSize();
const minimize = (wLarge: string, wMobile: string) => {
return width < 640 ? wMobile : wLarge;
@Steellgold
Steellgold / zero.tsx
Created May 4, 2024 18:18
The addZero function is used to format numbers by adding a zero in front of those less than 10, thereby enhancing the visual presentation of digital displays, such as times or dates, to make them more aesthetically pleasing and consistent.
import { ReactElement } from "react";
export const TimeDisplay = (): ReactElement => {
const currentHour = new Date().getHours();
const currentMinute = new Date().getMinutes();
const formattedHour = addZero(currentHour);
const formattedMinute = addZero(currentMinute);
return <p>Current Time: {formattedHour}:{formattedMinute}</p>;
{"name":"JS","settings":"{\"settings\":\"{\\r\\n // Suppression de la sauvegarde automatique :\\r\\n \\\"files.autoSave\\\": \\\"off\\\",\\r\\n\\r\\n // Taille des tabulations par défaut :\\r\\n \\\"editor.tabSize\\\": 2,\\r\\n \\\"editor.formatOnSave\\\": false,\\r\\n\\r\\n // Linting & formatting on save :\\r\\n \\\"editor.codeActionsOnSave\\\": {\\r\\n \\\"source.fixAll.eslint\\\": \\\"explicit\\\"\\r\\n },\\r\\n \\\"[prisma]\\\": {\\r\\n \\\"editor.formatOnSave\\\": true,\\r\\n },\\r\\n \\r\\n \\\"editor.wordWrap\\\": \\\"bounded\\\",\\r\\n \\\"editor.wrappingIndent\\\": \\\"indent\\\",\\r\\n \\\"editor.wordWrapColumn\\\": 150,\\r\\n \\r\\n \\\"editor.rulers\\\": [\\r\\n {\\r\\n \\\"column\\\": 150,\\r\\n \\\"color\\\": \\\"#b1b1b127\\\"\\r\\n }\\r\\n ],\\r\\n \\r\\n \\\"javascript.updateImportsOnFileMove.enabled\\\": \\\"always\\\",\\r\\n \\\"typescript.updateImportsOnFileMove.enabled\\\": \\\"always\\\",\\r\\n\\r\\n // Theme :\\r\\n \\\"workbench.colorTheme\\\