Skip to content

Instantly share code, notes, and snippets.

@theednaffattack
theednaffattack / gist:ae6304695a9b17db26217775f4f879cf
Created Jun 17, 2021
Cursed TS Config (Error [ERR_REQUIRE_ESM]: Must use import to load ES Module:)
View gist:ae6304695a9b17db26217775f4f879cf
{
"compilerOptions": {
"target": "ES2019",
"module": "commonjs",
"lib": ["es2020"],
"sourceMap": true,
"outDir": "./dist",
"moduleResolution": "node",
"declaration": false,
"resolveJsonModule": true,
@theednaffattack
theednaffattack / Readme.md
Created Nov 8, 2020 — forked from leopoldodonnell/Readme.md
Install and run Postgres with an extension using docker-compose
View Readme.md

Local Postgres

This gist is an example of how you can simply install and run and extended Postgres using docker-compose. It assumes that you have docker and docker-compose installed and running on your workstation.

Install

  • Requires docker and docker-compose
  • Clone via http: git clone https://gist.github.com/b0b7e06943bd389560184d948bdc2d5b.git
  • Make load-extensions.sh executable
  • Build the image: docker-compose build
View gist:76946c466a8f51601fd7d50e9cd6c2d8
import { ReactElement } from "react";
import { frontMatter as blogPosts } from "./blog/*.mdx";
import BlogPost from "../components/blog-post";
const Blog = (): ReactElement[] =>
blogPosts.map((frontMatter) => (
<BlogPost key={frontMatter.title} {...frontMatter} />
));
View sample-migration.sql
-- migrate:up
SET search_path TO public;
CREATE TYPE role AS ENUM ('guest', 'administrator', 'moderator', 'manager');
ALTER TABLE ONLY public.user
ADD roles role;
-- migrate:down
View deploy-script
#! /bin/bash
yarn build:server
docker build -t <DOCKER_REGISTRY_USERNAME>/<DOCKER_IMAGE_NAME>:<DOCKER_TAG> ./PATH/TO/DOCKERFILE
docker push <DOCKER_REGISTRY_USERNAME>/<DOCKER_IMAGE_NAME>:<DOCKER_TAG>
ssh <SSH_USER>@<SERVER_IP> "cd <DIRECTORY_OF_ALREADY_DEPLOYED_DOCKER-COMPOSE.YML_FILE> && docker-compose pull && docker-compose up"
View typescript-styled-system-attempt_3
import { SpaceProps } from "styled-system";
type TStyledLi = DetailedHTMLProps<
LiHTMLAttributes<HTMLLIElement>,
HTMLLIElement
> &
SpaceProps;
export const StyledLi: React.FC<TStyledLi> = styled.li`
View typescript-styled-system-attempt_2
import { Flex as FlexBase, FlexProps } from "rebass";
import {
maxWidth,
minHeight,
borders,
MinHeightProps,
BordersProps
} from "styled-system";
import styled from "styled-components";
View typescript-styled-system-attempt_1
// https://gist.github.com/theednaffattack/790b3dc87d3c0c02227c2494e5daf15e
import { Button as MyButton, ButtonProps, Text } from "rebass";
import {
borderRadius,
boxShadow,
BorderRadiusProps,
BoxShadowProps,
TLengthStyledSystem
} from "styled-system";
View gist:b5e04fa23943d242b3bb430e7b4d61e7
// These are the introspection queries (note POST method) by GraphQL Playground
2019-07-18T22:14:14.319808+00:00 heroku[router]: at=info method=POST path="/graphql" host=eddie-faux-gram.herokuapp.com request_id=458285a3-d959-453b-b259-3440c13647dc fwd="73.70.116.10" dyno=web.1 connect=1ms service=7ms status=500 bytes=429 protocol=https
// These are subscriptions
2019-07-18T22:14:18.412631+00:00 heroku[router]: at=info method=GET path="/subscriptions" host=eddie-faux-gram.herokuapp.com request_id=4c0b335a-a4fc-4906-a899-9ca74c36ff0f fwd="73.70.116.10" dyno=web.1 connect=1ms service=191ms status=101 bytes=165 protocol=http
View Eddie's SSR ssr.js (the app) file
const React = require("react")
const ReactDOM = require("react-dom")
const Meep = (
<div
style={{ backgroundColor: "blue", fontColor: "white" }}
onClick={() => alert("hello")}
>
Hello world?
</div>