Skip to content

Instantly share code, notes, and snippets.

View dschinkel's full-sized avatar
💻

Dave Schinkel dschinkel

💻
View GitHub Profile
@dschinkel
dschinkel / App.js
Created September 25, 2020 01:08
Using React Router and Hooks Router in the Same App
import React, { Component } from 'react';
import { Route, Switch } from 'react-router-dom';
...
import { useRoutes } from 'hookrouter';
export const routes = {
'/login': () => <Login />
};
const RenderRoutes = () => {
@dschinkel
dschinkel / examples.auth.github.container.registry.yml
Last active September 5, 2020 06:59
GitHub Actions - Authing into GitHub Container Repository
# stdout a github secret (environment variable) to stdin with docker login command
- run: echo ${{ secrets.GHCP_ACCESS_TOKEN }} | docker login ghcr.io -u USERNAME --password-stdin
@dschinkel
dschinkel / react-router-functional-component.ts
Created August 17, 2020 23:45
Cookebook - React/TypeScript - React Router via Functional Component (unverified)
//source: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/17355
import { RouteComponentProps } from 'react-router-dom';
type MyProps = RouteComponentProps<{ id?: string }>
const CoolThing: React.FC<MyProps> = ({ match }) => {
const id = match.params.id;
return (
it('only sends one welcome message', async () => {
mockPost('/chat.postMessage', { called: true });
const channel = '';
const user: SlackUser = {
token: '',
trigger_id: '',
view: undefined,
id: '',
team_id: ''
};
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#define NUMBER_OF_DAYS 3
// Put your code below:
int main(void)
{
int k, highEntry, lowEntry;
printf("-- -= == IPC Temperature Analyzer == = --\n");
for (int i = 1; i < NUMBER_OF_DAYS; i++)
@dschinkel
dschinkel / MakeCallTest.java
Last active August 16, 2019 16:25
Roboelectric - Example of Finding a Child Fragment from a test
/*
Dave Schinkel's Notes after he wrote this test:
This is a test I wrote headlessly with Roboelectric around an existing Legacy codebase that's a mess.
We want to get some sort of confidence with an integration test which is what this test gave us for a
certain part of this codebase.
This test indirectly tests behavior further down by
checking what I ultimately expected to be rendered
@dschinkel
dschinkel / gulpfile.js
Created July 12, 2019 05:24
Gulp v4 Build
const gulp = require('gulp'),
less = require('gulp-less'),
babel = require("gulp-babel"),
shell = require('gulp-shell'),
mocha = require('gulp-mocha'),
rename = require('gulp-rename'),
bro = require('gulp-bro'),
del = require('del'),
{ series, dest, src } = require('gulp');
@dschinkel
dschinkel / Calculator.kt
Last active May 28, 2019 00:30
Roman Numeral Calculator kata - Kotlin
package roman.numeral.calculator.kotlin
class Calculator {
private val toRoman = mapOf(
"IIIII" to "V",
"VV" to "X",
"XXXXX" to "L",
"LL" to "C",
"CCCCC" to "D",
@dschinkel
dschinkel / Calculator.kt
Last active May 17, 2019 06:16
Attempt 4
package roman.numeral.calculator.kotlin
class Calculator {
private val toRoman = mapOf(
"IIIII" to "V",
"VV" to "X",
"XXXXX" to "L",
"LL" to "C",
"CCCCC" to "D",
"DD" to "M"
@dschinkel
dschinkel / SomeSpecUsingSuperagent.js
Last active May 14, 2019 23:41
Some example Mocha, Supertest, and Superagent tests I've written
/*
Note:
Uses superagent and mocha assertions.
This is how I do these tests nowdays, without supertest, just plain superagent.
*/
import request from 'superagent'
it('returns a list of participants', async () => {
const url = 'https://someurl';