Skip to content

Instantly share code, notes, and snippets.

@theednaffattack
theednaffattack / xdm-solid.ts
Created February 28, 2022 16:12 — forked from CyriacBr/xdm-solid.ts
Support SolidJs inside MDX files
import { compile } from 'xdm';
import * as Path from 'path';
import * as fs from 'fs';
import * as babel from '@babel/core';
import esbuild from 'esbuild';
async function main() {
/**
* Compile MDX file with XDM
*/
@theednaffattack
theednaffattack / eslint-package-json.js
Created February 21, 2022 22:45 — forked from richardtallent/eslint-package-json.js
Example eslint config in a package.json
"prettier": {
"useTabs": true,
"semi": false,
"singleQuote": false,
"bracketSpacing": true,
"trailingComma": "es5",
"printWidth": 160
},
"eslintConfig": {
"parserOptions": {
import { logger } from "./lib.logger";
type AsyncTuple<U> = [U | null, Error | null];
export async function handleAsyncTs<U extends (...args: any[]) => Promise<AsyncTuple<U>>>(func: U) {
return async function (...args: Parameters<U>): Promise<[U | null, Error | null]> {
try {
let data = await func(...args);
// If the promise succeeded but doesn't return
@theednaffattack
theednaffattack / gist:ae6304695a9b17db26217775f4f879cf
Created June 17, 2021 23:35
Cursed TS Config (Error [ERR_REQUIRE_ESM]: Must use import to load ES Module:)
{
"compilerOptions": {
"target": "ES2019",
"module": "commonjs",
"lib": ["es2020"],
"sourceMap": true,
"outDir": "./dist",
"moduleResolution": "node",
"declaration": false,
"resolveJsonModule": true,
@theednaffattack
theednaffattack / Readme.md
Created November 8, 2020 21:25 — forked from leopoldodonnell/Readme.md
Install and run Postgres with an extension using docker-compose

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
@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} />
));
-- 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 / 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"
import { SpaceProps } from "styled-system";
type TStyledLi = DetailedHTMLProps<
LiHTMLAttributes<HTMLLIElement>,
HTMLLIElement
> &
SpaceProps;
export const StyledLi: React.FC<TStyledLi> = styled.li`
import { Flex as FlexBase, FlexProps } from "rebass";
import {
maxWidth,
minHeight,
borders,
MinHeightProps,
BordersProps
} from "styled-system";
import styled from "styled-components";