Skip to content

Instantly share code, notes, and snippets.

View jsamr's full-sized avatar

Jules Sam. Randolph jsamr

  • QAWolf
View GitHub Profile
@jsamr
jsamr / useFetch.ts
Last active June 29, 2022 14:06
Explicit Finite State Machine Pattern
import { useCallback, useEffect, useReducer } from "react";
type FetchTransition<P> =
| {
type: "fetch";
}
| {
type: "fetchOK";
data: P;
}
function useDelayedRendering<T>({
element,
delay = 200,
}: {
element: T;
delay: number;
}) {
const [renderedEl, setRenderedEl] = useState(element);
const lastRenderedAt = useRef(Date.now());
// Type definitions for patchinko v4.1.0
// Project: patchinko
// Typescript: 3.1.6
// Definitions by: Jules Samuel Randolph <https://github.com/jsamr>
declare module 'patchinko' {
type DeepPartial<T> = {
[P in keyof T]?: T[P] extends Array<infer U> ? Array<DeepPartial<U>> : T[P] extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : DeepPartial<T[P]>;
}
// Utility types
@jsamr
jsamr / Table.jsx
Created March 8, 2019 15:01
React native table
import React, { PureComponent } from 'react'
import { WebView } from 'react-native-webview'
const htmlStyle = `
:root {
color: #333333;
background-color: transparent;
}
body, html {
margin: 0;
@jsamr
jsamr / affirmation
Created July 21, 2018 13:07
MuleSoft Contributor Agreement Acceptance by Jules Samuel Randolph
I, Jules Samuel Randolph, have read and do accept the MuleSoft Contributor Agreement
at http://www.mulesoft.org/legal/contributor-agreement.html
Accepted on Sat Jul 21 2018 09:07:16 GMT-0400 (EDT)
@jsamr
jsamr / bootiso
Last active April 4, 2021 23:23
A bash script to very easily create a bootable USB device from one ISO file. Just curl it, chmod it and go!
#!/bin/bash
# Author: jules randolph <jules.sam.randolph@gmail.com> https://github.com/jsamr
# License: MIT
#
# Usage: [<options>] <file.iso>
#
# Create a bootable FAT32 USB device from a linux-GNU/unix ISO.
#
# Options
www.facebook.com
twitter.com
@jsamr
jsamr / leechblock worktime
Created December 6, 2016 14:54
A file for leechblock
www.facebook.com
facebook.com
youtube.com
feedly.com
twitter.com
www.lemonde.fr
 v 1.1.0

 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 |||                                                                           |||
 !!! MERCI DE LIRE ATTENTIVEMENT CE DOCUMENT AVANT DE COMMENCER LE LABORATOIRE !!!
 |||                                                                           |||
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
@jsamr
jsamr / vwin10
Created October 10, 2016 16:12
KVM + SPice Windows VM client script
#!/bin/bash
# Need to install remote-viewer
remote-viewer -f -t "windows 10" spice://localhost:5900