Skip to content

Instantly share code, notes, and snippets.

View lwillmeth's full-sized avatar

Levi W. lwillmeth

View GitHub Profile
@lwillmeth
lwillmeth / example-consumer-pact.js
Created September 20, 2019 16:27
Example questioning the value of assertions while creating a contract
// based on https://github.com/pact-foundation/pact-js/blob/master/examples/mocha/test/get-dogs.spec.js#L40-L75
describe("get /dogs", () => {
it("returns the correct response", async () => {
await provider.addInteraction({
state: "i have a list of dogs",
uponReceiving: "a request for all dogs",
withRequest: {
method: "GET",
path: "/dogs",
const defaultOptions = Object.freeze({
delayMs: 0, // (ms delay on all invocations)
retries: 3, // (retry failed promises up to 3 times each)
errorDelayMs: 100, // (ms delay after first error)
exponential: true, // (if true then double errorDelayMs on consecutive errors)
throwOnError: true, // (set to false to only log errors that fail to retry)
keepErrors: false, // (set to true to return an Array in `.errors`)
logger: console, // (set to initialized lib-logger-nodejs)
verbose: process.env.VERBOSE || false, // (set to true to log summary of successes and errors every time)
errorMsg: '' // (additional error message to display if all retries fail)
const path = require('path')
const chromeArgs = [
'--headless',
'--single-process',
'--disable-gpu',
'--disable-background-timer-throttling',
'--disable-breakpad',
'--disable-client-side-phishing-detection',
'--disable-cloud-import',
console.log('A');
const FetchKeys = new Promise((resolve, reject) => {
setTimeout(function () {
resolve('Hello world!');
}, 1000);
});
Promise.all([FetchKeys])
.then(res => {
console.log('A');
(async () => {
try {
const result = await new Promise((resolve, reject) => {
resolve('B');
});
console.log(result); // B
} catch (e) {
console.log('caught something');
@lwillmeth
lwillmeth / initials.java
Created January 11, 2014 19:07
CS161_Lab1 ASCII Initials
// * * * * * * * * * * * * * * * * * * * * * * * * * * *
// Name: Levi Willmeth Folder Name: willmeth_l
// CS161 Winter 2014 Assignment: Lab 1
// Class time: Mon/Wed/Fri 12:00pm - 1:20 / 1:50
// Program Name: initials.class
// Program Description:
// Prints my initials 'LJW' in big asci text.
// * * * * * * * * * * * * * * * * * * * * * * * * * * *
import java.util.*; // required for Collections.shuffle
public class initials{ // initial class must be same as filename