Skip to content

Instantly share code, notes, and snippets.

View MrDesjardins's full-sized avatar

Patrick Desjardins MrDesjardins

View GitHub Profile
@MrDesjardins
MrDesjardins / .code-snippets
Created January 8, 2024 05:26
VsCode Snippet New React Component
"newrc": {
"prefix": ["newrc", "new-react-component"],
"body": ["import style from \"./${1/(.*)/${1:/capitalize}/}.module.css\";",
"export const ${1/(.*)/${1:/capitalize}/} = () => {",
" return <div className={style.${1/(.*)/${1:/capitalize}/}}>${1/(.*)/${1:/capitalize}/}</div>;",
"};"]
"description": "Create a new React component with its CSS module file import"
}
@MrDesjardins
MrDesjardins / gist:222d9842712a2f822c8a28a761c152a3
Last active December 13, 2022 03:24
Some Regex for MDX to find potential issues
# MDX validations
## Title Format with quote
title: "(.*)(\\.*)"
## Ensure date is yyyy-mm-dd
(date: )(?!("((20[012]\d|19\d\d)|(1\d|2[0123]))-((0[0-9])|(1[012]))-((0[1-9])|([12][0-9])|(3[01]))"))
## Scan to see if we have all the code block starting a line with tripple `
^(?!```).+(```)+.+$
@MrDesjardins
MrDesjardins / useInterval.tsx
Created April 4, 2022 18:27
React useInterval
import { useEffect, useRef } from "react";
export interface useIntervalProps {
callback: () => void;
intervalMs: number;
/**
* Option to have an initial call to the callback immediately once the hook is created and
* then at each interval. When not defined or false, the first callback call is delayed until
@MrDesjardins
MrDesjardins / withLog.tsx
Last active September 13, 2017 15:46
React-Router HOC
import * as React from "react";
export function withLog<P>(Comp: React.ComponentClass<P> | React.StatelessComponent<P>): React.ComponentClass<P> {
return class WrappedComponent extends React.Component<P, {}> {
public render(): JSX.Element {
console.log("render");
return <Comp {...this.props} />;
}
public componentDidMount() {
console.log("componentDidMount");
@MrDesjardins
MrDesjardins / ahk
Created March 16, 2017 04:50
Autohotkey Past One Char at a Time
F1::
Loop, parse, clipboard
{
SendRaw, %A_Loopfield%
Sleep, 40
}
return
@MrDesjardins
MrDesjardins / Reference Change MsBuild
Created March 14, 2016 19:45
Reference Change MsBuild
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemDefinitionGroup>
<Reference>
<Private>False</Private>
</Reference>
<ProjectReference>
<Private>False</Private>
</ProjectReference>
</ItemDefinitionGroup>
</Project>

Keybase proof

I hereby claim:

  • I am mrdesjardins on github.
  • I am mrdesjardins (https://keybase.io/mrdesjardins) on keybase.
  • I have a public key whose fingerprint is F2EB 8867 97B1 0BD7 DA19 8530 3E44 DA1D 4F30 817B

To claim this, I am signing this object: