Skip to content

Instantly share code, notes, and snippets.

// APP_ROOT/server.js
const { Meep: ReactSSR } = require("./src/ssr")
const sheet = new ServerStyleSheet()
try {
const html = renderToString(sheet.collectStyles(<ReactSSR />))
const styleTags = sheet.getStyleTags() // or sheet.getStyleElement();
} catch (error) {
// handle error
// ROOT/server.js
const express = require("express")
const { renderToString } = require("react-dom/server")
const { ServerStyleSheet } = require("styled-components")
const SSR = require("./static")
const { Meep: ReactSSR } = require("./src/ssr")
const React = require("react")
const ReactDOM = require("react-dom")
const Meep = (
<div
style={{ backgroundColor: "blue", fontColor: "white" }}
onClick={() => alert("hello")}
>
Hello world?
</div>
// 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
// https://gist.github.com/theednaffattack/790b3dc87d3c0c02227c2494e5daf15e
import { Button as MyButton, ButtonProps, Text } from "rebass";
import {
borderRadius,
boxShadow,
BorderRadiusProps,
BoxShadowProps,
TLengthStyledSystem
} from "styled-system";
import { Flex as FlexBase, FlexProps } from "rebass";
import {
maxWidth,
minHeight,
borders,
MinHeightProps,
BordersProps
} from "styled-system";
import styled from "styled-components";
import { SpaceProps } from "styled-system";
type TStyledLi = DetailedHTMLProps<
LiHTMLAttributes<HTMLLIElement>,
HTMLLIElement
> &
SpaceProps;
export const StyledLi: React.FC<TStyledLi> = styled.li`
@theednaffattack
theednaffattack / deploy-script
Created August 6, 2020 02:34
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"
-- 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
@theednaffattack
theednaffattack / gist:76946c466a8f51601fd7d50e9cd6c2d8
Created September 18, 2020 22:50
typescript + eslint, strange error
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} />
));