Skip to content

Instantly share code, notes, and snippets.

View justinrainbow's full-sized avatar

Justin Rainbow justinrainbow

View GitHub Profile
@mjackson
mjackson / composing-route-in-react-router-v6.md
Last active March 12, 2024 08:39
Notes on route composition in React Router v6, along with a suggested improvement you can make today to start upgrading

Composing <Route> in React Router v6

Composition of <Route> elements in React Router is changing in v6 from how it worked in v4/5 and in Reach Router. React Router v6 is the successor of both React Router v5 and Reach Router.

This document explains our rationale for making the change as well as a pattern you will want to avoid in v6 and a note on how you can start preparing your v5 app for v6 today.

Background

In React Router v5, we had an example of how you could create a element](https://github.com/remix-run/react-router/blob/320be7afe44249d5c025659bc00c3276a19f0af9/packages/react-router-dom/examples/Auth.js#L50-L52) to restrict access to certain routes on the page. This element was a simple [wrapper around an actual element that made a simple decision: is the user authenticated or not? If so, ren

# Source: https://gist.github.com/48f44d3974db698d3127f52b6e7cd0d3
###########################################################
# Automation of Everything #
# How To Combine Argo Events, Workflows, CD, and Rollouts #
# https://youtu.be/XNXJtxkUKeY #
###########################################################
# Requirements:
# - k8s v1.19+ cluster with nginx Ingress
@naomiajacobs
naomiajacobs / optimization.py
Last active January 1, 2021 16:45
bnt162b2 Vaccine Codon Optimization
from dnachisel import *
# Subbed in `CCTCCT` for `AAAGTT` to account for proline substitution
virus = 'ATGTTTGTTTTTCTTGTTTTATTGCCACTAGTCTCTAGTCAGTGTGTTAATCTTACAACCAGAACTCAATTACCCCCTGCATACACTAATTCTTTCACACGTGGTGTTTATTACCCTGACAAAGTTTTCAGATCCTCAGTTTTACATTCAACTCAGGACTTGTTCTTACCTTTCTTTTCCAATGTTACTTGGTTCCATGCTATACATGTCTCTGGGACCAATGGTACTAAGAGGTTTGATAACCCTGTCCTACCATTTAATGATGGTGTTTATTTTGCTTCCACTGAGAAGTCTAACATAATAAGAGGCTGGATTTTTGGTACTACTTTAGATTCGAAGACCCAGTCCCTACTTATTGTTAATAACGCTACTAATGTTGTTATTAAAGTCTGTGAATTTCAATTTTGTAATGATCCATTTTTGGGTGTTTATTACCACAAAAACAACAAAAGTTGGATGGAAAGTGAGTTCAGAGTTTATTCTAGTGCGAATAATTGCACTTTTGAATATGTCTCTCAGCCTTTTCTTATGGACCTTGAAGGAAAACAGGGTAATTTCAAAAATCTTAGGGAATTTGTGTTTAAGAATATTGATGGTTATTTTAAAATATATTCTAAGCACACGCCTATTAATTTAGTGCGTGATCTCCCTCAGGGTTTTTCGGCTTTAGAACCATTGGTAGATTTGCCAATAGGTATTAACATCACTAGGTTTCAAACTTTACTTGCTTTACATAGAAGTTATTTGACTCCTGGTGATTCTTCTTCAGGTTGGACAGCTGGTGCTGCAGCTTATTATGTGGGTTATCTTCAACCTAGGACTTTTCTATTAAAATATAATGAAAATGGAACCATTACAGATGCTGTAGACTGTGCACTTGACCCTCTCTCAGAAACAAAGTGTACGTTGAAATCCTTCAC
@ClickerMonkey
ClickerMonkey / types.ts
Last active February 6, 2024 07:21
Typescript Helper Types
// when T is any|unknown, Y is returned, otherwise N
type IsAnyUnknown<T, Y, N> = unknown extends T ? Y : N;
// when T is never, Y is returned, otherwise N
type IsNever<T, Y = true, N = false> = [T] extends [never] ? Y : N;
// when T is a tuple, Y is returned, otherwise N
// valid tuples = [string], [string, boolean],
// invalid tuples = [], string[], (string | number)[]
@manugarri
manugarri / nyc_tagger.ipynb
Created May 5, 2016 13:42
NYT ingredient tagger implementation with pyCRFSuite
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jasonrdsouza
jasonrdsouza / combineS3Files.py
Last active June 3, 2023 17:22
Python script to efficiently concatenate S3 files
'''
This script performs efficient concatenation of files stored in S3. Given a
folder, output location, and optional suffix, all files with the given suffix
will be concatenated into one file stored in the output location.
Concatenation is performed within S3 when possible, falling back to local
operations when necessary.
Run `python combineS3Files.py -h` for more info.
'''
@Dr-Nikson
Dr-Nikson / README.md
Last active June 8, 2023 12:04
Auth example (react + redux + react-router)
@progrium
progrium / sshmany
Last active April 20, 2016 12:37
bash script for executing a command via ssh in parallel on multiple servers with colored output
#!/bin/bash
#
# Usage:
# $ echo "host1 host2 host3" | ./sshmany uname -a
# $ cat myservers | ./sshmany echo Hello world
#
cmd="$@"
servers="$(cat)"
i=37
for server in $servers; do
@asm89
asm89 / gist:5797852
Last active December 18, 2015 14:29
Rerun PHPUnit on file changes in a given dir (defined in my .bashrc)
# watch files and rerun phpunit on changes
phpunitwait() {
while inotifywait $(find $1 -name '*.php');
do
clear;
phpunit --colors $2;
done;
}
@pborreli
pborreli / YourCommand.php
Last active August 23, 2020 09:48
Show progress of a file download inside Symfony 2.3 console #howto
<?php
protected function execute(InputInterface $input, OutputInterface $output)
{
$progress = $this->getHelperSet()->get('progress');
$ctx = stream_context_create(array(), array('notification' => function ($notification_code, $severity, $message, $message_code, $bytes_transferred, $bytes_max) use ($output, $progress) {
switch ($notification_code) {
case STREAM_NOTIFY_FILE_SIZE_IS:
$progress->start($output, $bytes_max);
break;