Skip to content

Instantly share code, notes, and snippets.

View ahtcx's full-sized avatar

Alexandre Hitchcox ahtcx

View GitHub Profile
@ahtcx
ahtcx / script.js
Created February 25, 2026 11:24
YouTube Jump Ahead Shortcut User Script
// ==UserScript==
// @name YouTube Jump Ahead Shortcut
// @namespace https://aht.cx/userscripts/youtube-jump-ahead-shortcut
// @version 1.0
// @description Keyboard shortcut for the "Jump ahead" button available to YouTube Premium users
// @match https://www.youtube.com/watch*
// @run-at document-end
// @grant none
// ==/UserScript==
@ahtcx
ahtcx / PillButtonStyle.swift
Created August 29, 2024 22:10
A button style designed to highlight key actions with a pill-shaped appearance
import SwiftUI
/// A button style designed to highlight key actions with a pill-shaped appearance
///
/// To apply this style to a button, use the `buttonStyle(_:)` modifier.
/// For example:
/// ```swift
/// Button("Action") {
/// // Button action
/// }
import SwiftUI
/// A custom button style designed specifically for use with `NavigationLink`.
///
/// `NavigationLinkButtonStyle` allows you to apply a `PrimitiveButtonStyle` to a `Button` within a `NavigationLink` in SwiftUI.
/// This style adds a forward chevron image to the button, providing a visual cue for navigation.
///
/// Example Usage:
/// ```swift
/// NavigationLink("Navigate") {

hey :)

const getTypeofValue = (value: any) => typeof value;
export type TypeofReturnType = ReturnType<typeof getTypeofValue>;
// prettier-ignore
export type TypeFromTypeString<TypeString extends TypeofReturnType> =
TypeString extends "string" ? string :
TypeString extends "number" ? number :
TypeString extends "bigint" ? BigInt :
TypeString extends "boolean" ? boolean :
TypeString extends "symbol" ? symbol :
export type UseRasterizedImageUrlParameters = [imageUrl: string, width: number, height?: number];
export interface UseRasterizedImageUrlCache {
promise: Promise<void>;
inputs: UseRasterizedImageUrlParameters;
error?: unknown;
rasterizedImageUrl?: string;
}
const caches: UseRasterizedImageUrlCache[] = [];
import { useCallback, useState } from "react";
export const useForceUpdate = () => {
const [, dispatch] = useState(Object.create(null));
return useCallback(() => dispatch(Object.create(null)), [dispatch]);
};
import { useEffect, useRef } from 'react'
export interface ScrollEvents<Event extends any> {
scrollStart?: (event: Event) => void
scrollStop?: (event: Event) => void
scroll?: (event: Event) => void
}
export const useScrollEvents = <Event extends any = React.UIEvent>(
scrollEvents: ScrollEvents<Event>,
@ahtcx
ahtcx / useInterval.ts
Created November 1, 2019 14:32
TypeScript version of Dan Abramov's `useInterval`
import { useEffect, useRef } from 'react'
type Callback = () => void
export const useInterval = (callback: Callback, delay: number | null = null) => {
const savedCallback = useRef<Callback>()
useEffect(() => {
savedCallback.current = callback
}, [callback])
@ahtcx
ahtcx / intra_api.md
Last active January 5, 2025 10:50
Non-official list of Epitech Intra API endpoints

Epitech API

Epitech's API is located at https://intra.epitech.eu/ and for the most part is any intranet page with the format=json param added.

Authentication

To access most endpoints a PHPSESSID cookie must be set to an authenticated session. Authentification can be done with an autologin code or via Office 365 oauth.

Endpoints

API endpoints and what they require and do. JSON file of endpoints below the documentation.