Skip to content

Instantly share code, notes, and snippets.

View JonathonRichardson's full-sized avatar

Jonathon Richardson JonathonRichardson

  • Milliman
  • Madison, WI
View GitHub Profile
@JonathonRichardson
JonathonRichardson / Dockerfile
Last active May 25, 2023 21:16
Dev Container Config
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/ubuntu/.devcontainer/base.Dockerfile
# [Choice] Ubuntu version (use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon): ubuntu-22.04, ubuntu-20.04, ubuntu-18.04
ARG VARIANT="jammy"
FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT}
# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>
@JonathonRichardson
JonathonRichardson / prettier.config.js
Created December 17, 2022 14:04
My Default Prettier Config
// https://prettier.io/docs/en/configuration.html
//
// All properties are in alphabetical order so they're easy to find and insertions are consistent.
//
// This file uses the .js version so that code can be commented inline.
module.exports = {
// Always is the default.
//
// This wouldn't be strong enough argument to override the default if it was different, but there are
// languages (*cough* perl *cough*) where fat arrows '=>' are the same as commas at varying levels of
@JonathonRichardson
JonathonRichardson / .eslintrc.js
Created December 17, 2022 14:03
My Base ESLint Configuration
// This const doesn't actually do anything with regards to .eslintrc.js except
// document my preferred list of plugins, and allow me to document why I might
// choose any given plugin. You still have to manually install all of these,
// and they are not picked up because they're defined here.
const pluginsAndPackages = [
"@typescript-eslint/eslint-plugin",
"@typescript-eslint/parser",
"eslint-config-prettier",
"eslint-import-resolver-typescript",
"eslint-import-resolver-webpack",
@JonathonRichardson
JonathonRichardson / .editorconfig
Created December 17, 2022 13:01
My Base .editorconfig File
# EditorConfig is awesome: https://EditorConfig.org
# See Prettier config for more information on the rationale behind these. If you
# change these, you should change .prettierrc.json as well.
[*]
end_of_line = lf
indent_style = space
indent_size = 4
insert_final_newline = true
@JonathonRichardson
JonathonRichardson / nginx.conf
Created December 13, 2022 21:16
nginx Reverse Proxy
events {
}
http {
error_log /etc/nginx/error_log.log warn;
client_max_body_size 60m;
include mime.types;
{
"Function Component": {
"prefix": ["component.fn"],
"body": [
"// #region imports",
"import * as React from \"react\"",
"// #endregion imports",
"",
"interface IProps { /* eslint-disable-line @typescript-eslint/no-empty-interface */ /* prettier-ignore */ } ",
"",
@JonathonRichardson
JonathonRichardson / ExposeInternalsToTestProject.cs
Created November 4, 2022 17:24
Exposing internals of a CS project to a test project
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("MCV.Lobos.Services.Database.Tests")]
/**
* Allow dynamically generated proxy types to access internals. For details see
* https://stackoverflow.com/questions/17569746/mocking-internal-classes-with-moq-for-unit-testing/17574183#17574183
*/
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
namespace MCV.Lobos.Services.Database
{
@JonathonRichardson
JonathonRichardson / ExampleApp.tsx
Created December 12, 2020 18:15
Code for Stack Overflow To Answer Question https://stackoverflow.com/q/40015336/4339894
import * as React from 'react';
import * as ReactDOM from 'react-dom';
interface IProps {
text: string;
}
export class HTMLComment extends React.Component<IProps> {
private node: Comment;
private ref$rootDiv = React.createRef<HTMLDivElement>();
@JonathonRichardson
JonathonRichardson / HTMLComment.tsx
Created December 12, 2020 17:30
React Component for HTML Comment
import * as React from 'react';
import * as ReactDOM from 'react-dom';
interface IProps {
text: string;
}
export class HTMLComment extends React.Component<IProps> {
private node: Comment;
private ref$rootDiv = React.createRef<HTMLDivElement>();
@JonathonRichardson
JonathonRichardson / helpers.ts
Created March 14, 2018 16:57
File Download Helper Functions
/**
* Takes a HTTP response that represents file data and parses out the file name from
* the Content-Disposition and pulls the Blob object representing the body content of
* the response.
* @param response The response object that fetch returns
*/
export function getBlobAndFilenameFromResponse(response: Response): Promise<{filename: string, blob: Blob}> {
// Get the file name
let filename = 'unknown';