Skip to content

Instantly share code, notes, and snippets.


Trevor Harmon thetrevorharmon

View GitHub Profile
thetrevorharmon / example-query.js
Last active Sep 21, 2022
Query JSON with S3 Select in Node.js
View example-query.js
// See for a full explanation of this code
const AWS = require('aws-sdk');
const S3 = new AWS.S3();
exports.handler = async (_, context) => {
try {
const query = 'SELECT * FROM s3object[*].results[*] r;';
// test query is against data from
thetrevorharmon /
Created Jun 19, 2018
These commands help you install the Apple Font Tools, since their installer doesn't work on newer versions of macOS.
# Mount the font tools dmg as a volume on your Mac
hdiutil attach ~/Downloads/osxfonttools.dmg
# Navigate into the volume and copy
# the main .pkg file somewhere locally
# so you can manipulate it
cd /Volumes/OS\ X\ Font\ Tools/
pkgutil --expand OS\ X\ Font\ Tools.pkg ~/fontTools && cd ~/fontTools
# If you ls, here's what's in the file
thetrevorharmon / example-form.tsx
Last active Apr 5, 2021
Gatsby Mailchimp Signup Form
View example-form.tsx
import addToMailchimp from 'gatsby-plugin-mailchimp';
import React, { useState } from 'react';
import * as styles from './EmailListForm.module.scss';
const EmailListForm: React.FunctionComponent<{}> = () => {
const [email, setEmail] = useState('');
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
thetrevorharmon / Helmet.tsx
Created Jan 10, 2019
A wrapper around react-helmet that makes use of StaticQuery from Gatsby.
View Helmet.tsx
import { graphql, StaticQuery } from 'gatsby';
import * as React from 'react';
import { Helmet as ReactHelmet } from 'react-helmet';
interface HelmetProps {
pageTitle?: string;
interface HelmetDataProps extends HelmetProps {
data: {
thetrevorharmon / StaticQuery-and-typescript.tsx
Created Nov 29, 2018
An example of how to use Gatsby's StaticQuery with Typescript
View StaticQuery-and-typescript.tsx
import { graphql, StaticQuery } from 'gatsby';
import * as React from 'react';
interface HeaderProps {
className: string;
interface HeaderPropsWithData extends HeaderProps {
data: {
site: {
thetrevorharmon / index.html.slim
Created Feb 7, 2018
Rails Scaffold with Slim
View index.html.slim
p#notice #{notice}
h1 <%= plural_table_name.titleize %>
<% attributes.reject(&:password_digest?).each do |attribute| -%>
th <%= attribute.human_name %>
<% end -%>
th colspan="3"
View index.html.erb
<p id="notice"><%%= notice %></p>
<h1><%= plural_table_name.titleize %></h1>
<% attributes.reject(&:password_digest?).each do |attribute| -%>
<th><%= attribute.human_name %></th>
<% end -%>