Skip to content

Instantly share code, notes, and snippets.

View beardedtim's full-sized avatar
💭
I may be slow to respond.

Tim Roberts beardedtim

💭
I may be slow to respond.
View GitHub Profile
@beardedtim
beardedtim / fun.sh
Last active September 4, 2020 15:44
Bash Functions for JS Dev
is_npm_project() {
PACKAGE_LOCK=package-lock.json
if test -f "$PACKAGE_LOCK"; then
echo "true"
else
echo "false"
fi
}
@beardedtim
beardedtim / after.ts
Last active August 1, 2020 13:49
How to do this better?
export const list = async (query: Query, db: DB) => db
// Subquery to get the main things we are going to
// join against. If we don't do this, our JOIN
// throws off our limit/offset query
.from((builder: DB) => builder.from('recipes')
.select('*')
.limit(query.limit)
.offset(query.offset)
.orderBy(query.sort_col, query.sort_ord)
.where(query.where || {})
import React, {useState, useEffect} from 'react';
import Axios from 'axios';
import './App.css';
import AutoComplete from './AutoComplete'
function App() {
const [globalStats, setGlobalStats] = useState({})
const [countryStats, setCountryStats] = useState({})
const retriveStats = () => Axios.get('https://api.covid19api.com/summary')
@beardedtim
beardedtim / App.js
Created June 5, 2020 16:00
Basic App structure
import React, {useState, useEffect} from 'react';
import Axios from 'axios';
import './App.css';
import AutoComplete from './AutoComplete'
function App() {
const [globalStats, setGlobalStats] = useState({})
const [countryStats, setCountryStats] = useState({})
const retriveStats = () => Axios.get('https://api.covid19api.com/summary')
@beardedtim
beardedtim / index.rs
Created June 2, 2020 12:16
Autocomplete in Rust
use std::io;
#[derive(Debug)]
struct AutoCompleteRequest {
value: String
}
#[derive(Debug)]
struct AutoCompleteResponse {
suggestions: Vec<String>
@beardedtim
beardedtim / index.md
Last active March 6, 2020 14:32
Setting up a domain on AWS for Rotue 53, ACM, and SES

Setting Up a Domain on AWS

Overview

This document outlines the steps needed to set up a domain from GoDaddy onto AWS using services such as SES for email, Route 53 for DNS, and ACM for SSL certs.

Step 1: Go to GoDaddy and ensure you have the url

Step 2: Go to Route 53 and click "Create hosted zone"

@beardedtim
beardedtim / email.md
Last active February 24, 2020 15:19
Integrating SES with Postfix

Overview

We have failing SMTP requests because our port 25 was closed on our EC2 instances. These are the steps that you might want to follow in order to fix the SMTP issues and to be able to send email again.

Prior Art

You can look here for the docs that I followed to figure out the path forward.

@beardedtim
beardedtim / cf-distro.md
Created February 17, 2020 17:51
How to test that a CloudFront Distrobution works as intended

How to check that a cloudfront distro will work

Problem

You have some Elastic Beanstalk/Load Balancer that you want to attach multiple domains to. You want to use Route 53 to point to a CloudFront Distrobution, which will point at the ELB/EBS.

Solution

  • Go to Cloudfront
@beardedtim
beardedtim / wordpress.md
Created February 3, 2020 12:53
Setting up a Mac for WordPress
@beardedtim
beardedtim / README.md
Last active December 22, 2019 16:09
Create Express Routes Based on Folder Structure

Usage

The above script will create an Express Router with routes that mirror the folder structure, with the possibleAPIMethods file names being the verb handlers.

Example:

Given the folder structure