Skip to content

Instantly share code, notes, and snippets.

View amcdnl's full-sized avatar

Austin amcdnl

View GitHub Profile
@razor-x
razor-x / apollo-client.ts
Last active December 22, 2022 10:41
AppSync using Apollo Client with subscription support, and custom domain via Lambda@Edge
import type {
NormalizedCacheObject,
PossibleTypesMap,
Resolvers,
TypePolicies
} from '@apollo/client'
import {
ApolloClient as Client,
InMemoryCache,
createHttpLink,
@vipul79321
vipul79321 / us_market_yahoo_finance_ticker_to_stock.json
Created June 30, 2021 19:45
A dictionary of yahoo finance ticker symbol to ticker name for US Market
{
"A": "Agilent Technologies, Inc.",
"AA": "Alcoa Corporation",
"AABB": "Asia Broadband, Inc.",
"AAC": "Ares Acquisition Corporation",
"AACAF": "AAC Technologies Holdings Inc.",
"AACAY": "AAC Technologies Holdings Inc.",
"AACG": "ATA Creativity Global",
"AACQ": "Origin Materials Inc",
"AAGFF": "Aftermath Silver Ltd.",
@swaminator
swaminator / amplifyPush.sh
Last active December 28, 2019 02:37
The amplifyPush script
#!/usr/bin/env bash
set -e
IFS='|'
help_output () {
echo "usage: amplify-push <--environment|-e <name>> <--simple|-s>"
echo " --environment The name of the Amplify environment to use"
echo " --simple Optional simple flag auto-includes stack info from env cache"
exit 1
}
@oznu
oznu / index.js
Last active January 12, 2024 13:11
Homebridge Switch Plugin Example
'use strict'
let Service, Characteristic
module.exports = (homebridge) => {
/* this is the starting point for the plugin where we register the accessory */
Service = homebridge.hap.Service
Characteristic = homebridge.hap.Characteristic
homebridge.registerAccessory('homebridge-switch-example', 'SwitchExample', SwitchAccessory)
}
@ThomasBurleson
ThomasBurleson / tickets.facade.md
Last active February 22, 2024 07:41
Using ngrx with Effects + Facades

NgRx State Management with TicketFacade

Facades are a programming pattern in which a simpler public interface is provided to mask a composition of internal, more-complex, component usages.

When writing a lot of NgRx code - as many enterprises do - developers quickly accumulate large collections of actions and selectors classes. These classes are used to dispatch and query [respectively] the NgRx Store.

Using a Facade - to wrap and blackbox NgRx - simplifies accessing and modifying your NgRx state by masking internal all interactions with the Store, actions, reducers, selectors, and effects.

For more introduction, see Better State Management with Ngrx Facades

@amcdnl
amcdnl / readme.md
Last active January 31, 2021 17:05

Info

Goals

  • Modern TS
  • Little boilerplate
  • Better types

Features

  • Selectors
  • Easy Testing
@joshwiens
joshwiens / webpack-stats.js
Created January 18, 2017 23:04
Quite Webpack Stats
stats: {
colors: true,
hash: true,
timings: true,
chunks: true,
chunkModules: false,
children: false,
modules: false,
reasons: false,
warnings: true,
@iammerrick
iammerrick / PinchZoomPan.js
Last active April 22, 2024 02:54
React Pinch + Zoom + Pan
import React from 'react';
const MIN_SCALE = 1;
const MAX_SCALE = 4;
const SETTLE_RANGE = 0.001;
const ADDITIONAL_LIMIT = 0.2;
const DOUBLE_TAP_THRESHOLD = 300;
const ANIMATION_SPEED = 0.04;
const RESET_ANIMATION_SPEED = 0.08;
const INITIAL_X = 0;
@dimitrovs
dimitrovs / dockerhost.sh
Last active September 17, 2017 20:36
Add the IP of a dockerhost to the /etc/hosts file of a Docker container if not already there.
#!/bin/bash
if [[ -z $(grep dockerhost /etc/hosts) ]]
then
echo `/sbin/ip route|awk '/default/ { print $3 }'` dockerhost >> /etc/hosts
fi
@bmweiner
bmweiner / sonos_airplay.md
Last active December 30, 2023 19:30
Stream audio to any Sonos component via AirPlay using a Raspberry Pi.

Sonos Airplay

Stream audio to any Sonos component via AirPlay using a Raspberry Pi (Model B, Raspbian Jessie) and the following software:

  • Shairport Sync: configures the Raspberry Pi as an AirPlay audio player.
  • DarkIce: encodes audio received from AirPlay (system audio) and sends it to Icecast2.
  • Icecast2: serves streaming audio from DarkIce at a network URL.