This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Usage: | |
* const { alert, confirm, prompt } = useModals() | |
* alert("Hey!") // awaitable too | |
* if (await confirm("Are you sure?")) ... | |
* const result = await prompt("Enter a URL", "http://") | |
*/ | |
import React, { | |
createContext, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { graphql } = require("@octokit/graphql") | |
const REPO_OWNER = "x" | |
const REPO_NAME = "y" | |
const PROJECT_NUMBER = 2 | |
const COLUMN_TO_SORT = /To Do/ | |
const api = graphql.defaults({ | |
headers: { | |
authorization: `token ${process.env.GITHUB_TOKEN}`, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { FirehoseClient, PutRecordCommand } from "@aws-sdk/client-firehose" | |
const streamName = process.env.AWS_FIREHOSE_LOG_EVENT_STREAM | |
const client = new FirehoseClient({}) | |
export const logEvent = (type: string, data: Object) => { | |
try { | |
const record = Buffer.from( | |
JSON.stringify({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import getConfig from "next/config" | |
// Add publicRuntimeConfig: { oneSignalAppId: ... } to next.config.js | |
const { publicRuntimeConfig } = getConfig() | |
export const useOneSignal = (externalUserId?: string): void => { | |
// react-onsignal tries to use a global `document` variable, so we can only | |
// use it in the client side. Luckily this method doesn't trigger any "wrong | |
// number of hooks" errors either. | |
if (!process.browser) return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Want to know when ECS events happen in Slack? Try this. | |
(1) Create a new Slack app with an incoming webhook, save the webhook URL | |
(2) Create an SNS topic called something like ECSEvents | |
(3) Create a CloudWatch Rule that publishes all ECS events to the topic | |
(4) Create a Node.js Lambda that is triggered by the SNS topic | |
(5) Add a WEBHOOK_URL environment variable to the Lambda with the webhook URL | |
(6) Paste this code into index.js | |
(7) Paste the contents of https://unpkg.com/node-fetch/lib/index.js into fetch.js | |
(8) Deploy and enjoy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# <bitbar.title>Purple Air PM2.5 AQI</bitbar.title> | |
# <bitbar.dependencies>bash,jq,node</bitbar.dependencies> | |
# | |
# Derived from https://github.com/matryer/bitbar-plugins/blob/master/Weather/aqi.15m.sh by Chongyu Yuan | |
COLORS=("#0ed812" "#ffde33" "#ff9933" "#cc0033" "#660099" "#7e0023" "#404040") | |
PURPLE_AIR_SENSOR_ID=5220 |
Some support LinkedIn import.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Remember that additional env vars can be in a .env, which docker-compose | |
# uses when building the image. | |
FROM node:12.9.0-alpine AS base | |
VOLUME /usr/local/share/.cache/yarn | |
COPY ./ /app/ | |
WORKDIR /app/ | |
RUN npm install --silent --global yarn | |
RUN yarn install --pure-lockfile --non-interactive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.DS_Store | |
.env | |
.vscode | |
Dockerfile | |
docker-compose.yml | |
frontend/.next | |
frontned/out/ | |
node_modules | |
npm-debug.log* | |
yarn-debug.log* |