Skip to content

Instantly share code, notes, and snippets.

View DavidWells's full-sized avatar
😃

David Wells DavidWells

😃
View GitHub Profile
@helabenkhalfallah
helabenkhalfallah / httpFifoRequestsExecutor.js
Last active March 9, 2022 02:24
Async Http Requests Executor (FiFo) using ES6 Generator
function httpFiFoRequestsExecutor({
onTaskSuccess,
onTaskFail,
}) {
async function* execute(taskInfos, props) {
const {
taskIdentifier,
taskFn
} = taskInfos || {};
try {
@kentcdodds
kentcdodds / diff.js
Created April 29, 2021 17:23
A git diff for EpicReact workshops
const {spawnSync} = require('child_process')
const inquirer = require('inquirer')
const glob = require('glob')
async function go() {
const files = glob
.sync('src/+(exercise|final)/*.+(js|ts|tsx)', {
ignore: ['*.d.ts'],
})
.map(f => f.replace(/^src\//, ''))
@wlib
wlib / LICENSE
Last active April 30, 2024 17:07
Run a shell script with bash, line-by-line, prompted on each command. Useful for running unknown scripts or debugging. Not a secure substitute for understanding a script beforehand.
MIT License
Copyright (c) 2021 Daniel Ethridge
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@jackrusher
jackrusher / trinity.js
Created March 29, 2021 09:23
A fast, minimal JS triple store implementation in ~70 lines of code
// three indices to efficiently support all lookups
function createDB() {
return {eav: new Map(),
ave: new Map(),
vea: new Map()};
}
function addToIndex(xs, x, y, z, triple) {
let ys = xs.get(x);
if(ys == undefined) {
@singledigit
singledigit / Install-AWS-SAM.sh
Last active March 19, 2025 12:46
Install AWS SAM on Linux using the new Linux installer
curl -L https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip -o aws-sam-cli-linux-x86_64.zip
unzip aws-sam-cli-linux-x86_64.zip -d sam-installation
sudo ./sam-installation/install
where sam
sam --version
@kiding
kiding / NoScrollOnInputFocusiOSSafari.html
Last active April 23, 2025 08:59
Preventing iOS Safari scrolling when focusing on input elements
<!--
When an input element gets focused, iOS Safari tries to put it in the center by scrolling (and zooming.)
Zooming can be easily disabled using a meta tag, but the scrolling hasn't been quite easy.
The main quirk (I think) is that iOS Safari changes viewport when scrolling; i.e., toolbars shrink.
Since the viewport _should_ change, it thinks the input _will_ move, so it _should_ scroll, always.
Even times when it doesn't need to scroll—the input is fixed, all we need is the keyboard—
the window always scrolls _up and down_ resulting in some janky animation.
However, iOS Safari doesn't scroll when the input **has opacity of 0 or is completely clipped.**
@mdlavin
mdlavin / template.yml
Created January 23, 2021 20:37
Amplify custom auth domain template.yml
AWSTemplateFormatVersion: 2010-09-09
Parameters:
env:
Type: String
authCognitoResourceUserPoolId:
Type: String
Mappings:
CustomAuthDomains:
@mdlavin
mdlavin / amplify-custom-auth-domain-app.js
Created January 23, 2021 19:45
Amplify Custom Auth Domain Config Update
import awsconfig from "./aws-exports";
import Amplify from "@aws-amplify/core";
// Find the User Pool ID for your production deployment in
// the AWS Console
if (awsconfig.aws_user_pools_id === "us-east-1_M7n6RNrq9") {
awsconfig.oauth.domain = "auth.yourdomain.com;
}
Amplify.configure(awsconfig);
// connect route
const apigatewayroutesocketconnect = new apigateway.CfnRoute(this, "apigatewayroutesocketconnect", {
apiId:apigatewaysocket.ref,
routeKey: "$connect",
authorizationType: "AWS_IAM",
apiKeyRequired: false,
operationName: "ConnectRoute",
target: "integrations/"+new apigateway.CfnIntegration(this, "apigatewayintegrationsocketconnect", {
apiId: apigatewaysocket.ref,
integrationType: "AWS_PROXY",
@kentcdodds
kentcdodds / .gitignore
Last active November 28, 2023 17:31
This will create a Google Voice "native" app on your computer
node_modules