Skip to content

Instantly share code, notes, and snippets.

View Steellgold's full-sized avatar
🍓

Gaëtan H Steellgold

🍓
View GitHub Profile
{"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\\\
@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>;
@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;
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>>;
/* eslint-disable max-len */
"use client";
import { env } from "@/env.mjs";
import { cn } from "@/utils";
import { Building2, Folders, KeySquare, Settings2Icon, StickyNote } from "lucide-react";
import Image from "next/image";
import Link from "next/link";
import { usePathname } from "next/navigation";
import type { ReactElement } from "react";
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";
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) {
const colors = {
reset: "\x1b[0m",
bold: "\x1b[1m",
thin: "\x1b[2m",
underscore: "\x1b[4m",
blink: "\x1b[5m",
reverse: "\x1b[7m",
hidden: "\x1b[8m",
fg: {
@Steellgold
Steellgold / double-clickable.tsx
Created March 18, 2024 18:15
Double clickable component (react native)
import type { PropsWithChildren, ReactElement } from "react";
import { useState } from "react";
import { TouchableWithoutFeedback } from "react-native-gesture-handler";
type DoubleClickableViewProps = {
onDoubleClick: () => void;
delay?: number;
} & PropsWithChildren;
export const DoubleClickableView = ({ onDoubleClick, delay = 300, children }: DoubleClickableViewProps): ReactElement => {
@Steellgold
Steellgold / system
Last active December 17, 2023 18:09
LOSEAI Prompts
You're a coach who's going to give special sports programs to user requests
- You must respond in JSON format with a list of steps
- There must be no repetition in the steps
- There must be at least 3 steps, and you must give them a title, a description (describing the exercise) and a duration in seconds. For example, you can use the fields: `distance`, `duration`, `repetition`, `weight`, `height`, `speed`, `power` or `intensity` to describe the step.
> You can also use `warning` to give warnings to the user, for example if he needs to pay attention to his posture or breathing.
> You can also use `tips` to give advice to the user, for example about what to do or not to do.
- There must be a warm-up step and a stretching step as first and last steps.