Skip to content

Instantly share code, notes, and snippets.

View ewen-lbh's full-sized avatar
🎀
new album out!! ewen.works/emotions

Ewen Le Bihan ewen-lbh

🎀
new album out!! ewen.works/emotions
View GitHub Profile
@david-plugge
david-plugge / route.ts
Last active August 24, 2024 14:59
Sveltekit typesafe routes
import { resolveRoute } from '$app/paths';
import type RouteMetadata from '$lib/../../.svelte-kit/types/route_meta_data.json';
type RouteMetadata = typeof RouteMetadata;
// eslint-disable-next-line @typescript-eslint/ban-types
type Prettify<T> = { [K in keyof T]: T[K] } & {};
type ParseParam<T extends string> = T extends `...${infer Name}` ? Name : T;
type ParseParams<T extends string> = T extends `${infer A}[[${infer Param}]]${infer B}`
? ParseParams<A> & { [K in ParseParam<Param>]?: string } & ParseParams<B>
@pgrepds
pgrepds / gist:7c9a7e29a8b649369951e2002a85a3d0
Last active September 4, 2024 12:50
Matlab R2022a ArchLinux installer problem fix
I got problems installing Matlab R2022a on Arch. Running the installer throws the following error:
```
terminate called after throwing an instance of 'std::runtime_error'
what(): Failed to launch web window with error: Unable to launch the MATLABWindow application. The exit code was: 127
fish: Job 1, 'sudo ./install' terminated by signal SIGABRT (Abort)
```
I fixed it by running the following commands.
@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active September 17, 2024 13:27
Hyperlinks in Terminal Emulators
@dvliman
dvliman / gist:10402435
Created April 10, 2014 17:02
ruby $ global variable
$: (Dollar Colon) is basically a shorthand version of $LOAD_PATH. $: contains an array of paths that your script will search through when using require.
$0 (Dollar Zero) contains the name of the ruby program being run. This is typically the script name.
$* (Dollar Splat) is basically shorthand for ARGV. $* contains the command line arguments that were passed to the script.
$? (Dollar Question Mark) returns the exit status of the last child process to finish.
$$ (Dollar Dollar) returns the process number of the program currently being ran.
$~ (Dollar Tilde) contains the MatchData from the previous successful pattern match.
$1, $2, $3, $4 etc represent the content of the previous successful pattern match.
$& (Dollar Ampersand) contains the matched string from the previous successful pattern match.
$+ (Dollar Plus) contains the last match from the previous successful pattern match.
$` (Dollar Backtick) contains the string before the actual matched string of the previous successful pattern match.