Skip to content

Instantly share code, notes, and snippets.

View DavidWells's full-sized avatar
😃

David Wells DavidWells

😃
View GitHub Profile
@jsonberry
jsonberry / DateComponent.vue
Created October 12, 2021 00:22
Vue Native Platform Date Component Strategy
<template>
<fieldset class="date-input" :data-qa-id="id">
<legend>{{ legend }}</legend>
<component
@change="onChange($event)"
:is="component"
:custom-validity="customValidity"
v-bind="$props"
/>
</fieldset>
@farminf
farminf / alert.js
Created October 4, 2021 20:23
Sending PR Alerts Via Slack Using AWS Serverless and AWS CDK
const AWS = require("aws-sdk");
const fetch = require("node-fetch");
const crypto = require("crypto");
const slackChannel = process.env.SLACK_CHANNEL_URL;
const githubSecret = process.env.WEBHOOK_SECRET;
const verifyGitHubSignature = (req = {}, secret = "") => {
const sig = req.headers["X-Hub-Signature"];
const hmac = crypto.createHmac("sha1", secret);
const digest = Buffer.from(
import os
import pickle
import warnings
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from tensorflow.keras.callbacks import EarlyStopping
from tensorflow.keras.layers import Dense
from tensorflow.keras.layers import Dropout
@hew
hew / _readme.md
Last active September 29, 2021 12:28
Thoughts on standardizing REST with machines

Thoughts on standardizing REST with machines

@jonathantneal
jonathantneal / command.js
Last active October 26, 2022 07:20
Executable JavaScript Modules
":" //#;exec /usr/bin/env node --input-type=module - $@<$0
import process from 'process'
const { argv } = process
console.log(argv)
@kentcdodds
kentcdodds / index.js
Created July 9, 2021 21:40
Parsing HTML or Markdown and processing both as markdown then outputting to HTML
const unified = require('unified')
const parseMarkdown = require('remark-parse')
const parseHtml = require('rehype-parse')
const remark2rehype = require('remark-rehype')
const rehype2remark = require('rehype-remark')
const rehypeStringify = require('rehype-stringify')
const visit = require('unist-util-visit')
async function go() {
const inputString = `
@leegilmorecode
leegilmorecode / handler.js
Created June 27, 2021 14:29
Example of a lambda handler using the AWS AppConfig Lambda Layer Extension.
/* eslint-disable no-undef */
const axios = require("axios");
const {
STAGE: stage,
APPLICATION: application,
ENVIRONMENT: environment,
CONFIGURATION: configuration,
} = process.env;
@leegilmorecode
leegilmorecode / serverless.yml
Created June 27, 2021 14:26
Example of AWS AppConfig alongside the Serverless Framework for the use of Feature Flags
service: serverless-feature-flag
provider:
name: aws
runtime: nodejs12.x
lambdaHashingVersion: 20201221
memorySize: 128
stage: ${opt:stage, 'develop'}
region: eu-west-1
apiGateway:
shouldStartNameWithService: true
@emmiep
emmiep / graphql.config.js
Created May 27, 2021 14:29
VSCode next+graphql setup
/** @typedef {import("graphql-config").IGraphQLConfig} IGraphQLConfig */
const {loadEnvConfig} = require('@next/env');
loadEnvConfig(__dirname, true);
/** @type IGraphQLConfig */
const config = {
schema: process.env.GRAPHCMS_ENDPOINT,
extensions: {
@millsp
millsp / unionizeDeep.ts
Created May 17, 2021 17:43
Unionize Deep
type MarkUndefinable<A, B> = {
[K in keyof A]: A[K] extends O.Object
? MarkUndefinable<A[K], A.At<B, K>>
: K extends keyof B ? A[K] | undefined : A[K]
}
type UnionizeDeep<A extends object, B extends object> =
O.Merge<MarkUndefinable<A, B>, B, 'deep', M.BuiltIn, undefined>
type test = A.Compute<UnionizeDeep<{