Skip to content

Instantly share code, notes, and snippets.

View supermacro's full-sized avatar
🎯
Focusing

Gio supermacro

🎯
Focusing
View GitHub Profile
export const fetchComments = async ({
postId,
host
}: RequestInfo): Promise<Result<Array<Comments.Schema>, string>> => {
try {
const comments = await db(Comments.Table.name)
.select(everything(Comments.Table))
.join(
Posts.Table.name,
`${Comments.Table.name}.${Comments.Table.cols.post_id}`,
@supermacro
supermacro / schema.ts
Created November 1, 2018 20:29
types for defining JSON schemas
type Required<T> = {
[K in keyof T]: Schema<T>
}
interface ObjectSchema<T> {
type: 'object'
required: Array<keyof T>
properties: Required<T>
}
@supermacro
supermacro / binary-tree.elm
Created February 23, 2018 03:12
Elm Examples
{- OVERVIEW ------------------------------------------------------
A "Tree" represents a binary tree. A "Node" in a binary tree
always has two children. A tree can also be "Empty". Below I have
defined "Tree" and a number of useful functions.
This example also includes some challenge problems!
-----------------------------------------------------------------}
@supermacro
supermacro / index.html
Created October 10, 2016 21:26
Skeleton layout example
<!--HEADER-->
<header>
<div class="container">
<div class="row">
<div class="twelve columns">
<nav>
<ul>
<li><a href="#">About</a></li>
<li><a href="#">Work</a></li>
@supermacro
supermacro / reactions.html
Created June 10, 2015 00:22
Reaction Tester
<!doctype html>
<html>
<head>
<title>Reaction Tester</title>
<meta charset="utf-8" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="main.css">