Skip to content

Instantly share code, notes, and snippets.

View ThatJoeMoore's full-sized avatar

Joseph Moore ThatJoeMoore

View GitHub Profile
@ThatJoeMoore
ThatJoeMoore / README.md
Created July 8, 2020 19:27
MSW-Jest-JSDOM-Axios Issue

MSW-Jest-JSDOM-Axios issue

First, run npm i.

To see the issue, run npm test. We expect the test to succeed, instead it will error with:

TypeError: Protocol "http:" not supported. Expected "https:"TypeError [ERR_INVALID_PROTOCOL]: Protocol "http:" not supported. Expected "https:"
 at Object.proxiedOriginalRequest (node_modules/node-request-interceptor/lib/http/override.js:53:36)
@ThatJoeMoore
ThatJoeMoore / ideas.md
Last active February 12, 2020 21:23
Jest-Image-Snapshot image labelling

Image Format

  • Row 1, Col 1-3: RGB-encoded snapshot and version information.
  • Row 1, Col 4: 3-byte representation of header height, encoded as 1 px dot of an RGB color
  • Rows 2 - n: Header, plus a bottom border of arbitrary color
  • rows n+1 - ? : actual image

Reading

  1. Read color at row 1, column 1-3. This tells us if the existing snapshot used a label header and, if so, what version it used.
  2. Read color at row 1, column 4. This tells us how big the header is.
@ThatJoeMoore
ThatJoeMoore / claims.md
Last active January 31, 2019 20:57
BYU Claims API Draft

Proposal

This is a draft proposal for BYU API 'Claims'. This document is non-normative until approved and documented by whoever it is that approves and documents this kind of thing. Feedback is welcome and encouraged.

Things that need to be addressed or refined ("Yaks to shave") are denoted by a yak-like emoji: 🐃. The use of Yaks is blatantly stolen from inspired by SvelteJS.

Overview

Resource-based APIs, such as the University API, work well for fetching data. However, we often need to ask yes/no questions about a resource, such as "Is this person a full-time student" or "Does this person's Cougar Cash account have enough money to

@ThatJoeMoore
ThatJoeMoore / rockets.yml
Created August 24, 2018 16:07
UAPI Rockets
---
uapi: 1.0
info:
version: v1
title: Elon's Used Rocket Rentals
rest_endpoints:
- url: https://api.byu.edu/uapi/rockets/v1
description: Production
- url: https://api.byu.edu/uapi/rockets/dev
description: Development
@ThatJoeMoore
ThatJoeMoore / swagger.yml
Created October 26, 2017 16:44
Exchange API definition
---
swagger: "2.0"
info:
description: "Fronts Office 365/Exchange Online events APIs to add BYU OAuth support\
\ and a read-through cache."
version: "1.0.0"
title: "exchange-events-shim"
contact: {}
license:
name: "Apache 2.0"
@ThatJoeMoore
ThatJoeMoore / keybase.md
Created September 9, 2016 02:27
Keybase Verification

Keybase proof

I hereby claim:

  • I am thatjoemoore on github.
  • I am thatjoemoore (https://keybase.io/thatjoemoore) on keybase.
  • I have a public key ASCjbaHQ_1nMFhFi8ExEPGkQFVGQfgc4N2sSeuPjX_FcqAo

To claim this, I am signing this object:

SSLContext sslContext = SSLContexts.custom()
.useProtocol("TLS")
.loadTrustMaterial(new File("/etc/something"), "password".toCharArray())
.build();
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext);
HttpClient client = HttpClientBuilder.create()
.setSSLSocketFactory(sslsf)
.build();
@ThatJoeMoore
ThatJoeMoore / ReferenceVsValue.java
Last active September 1, 2015 04:47
Simple example of passing by value (primitive) vs reference (arrays and objects)
/**
* Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* (see http://creativecommons.org/licenses/by-nc-sa/4.0/)
*/
import java.util.Arrays;
/**
* @author Joseph Moore (joseph_moore@byu.edu)
*/
public class ReferenceVsValue {
@ThatJoeMoore
ThatJoeMoore / StringVsBuilder.java
Created August 29, 2015 17:35
Explanation of why you might want to use StringBuilder instead of String.concat().
import java.math.BigDecimal;
/**
* Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* (see http://creativecommons.org/licenses/by-nc-sa/4.0/)
*/
/**
* @author Joseph Moore (joseph_moore@byu.edu)
*/