Skip to content

Instantly share code, notes, and snippets.

View kauffmanes's full-sized avatar

Emily Kauffman kauffmanes

View GitHub Profile
@kauffmanes
kauffmanes / routes.mdx
Last active April 12, 2024 14:43
Route Conventions for a React Router App That Eventually Will be a Remix App

Option 1 - Almost Conventional Route Folders

This uses a routes folder to only define the routes, redirects, what data is loaded (useLoader). Other feature specific code would live in a components folder.

routes
├── _auth
│   ├── actions.tsx
│   ├── licenses.tsx
│   ├── login.tsx
│ ├── mfa.tsx
@kauffmanes
kauffmanes / cloudfront-remix-upload.md
Last active December 14, 2023 01:28
Upload a file to cloudfront in a Remix application

This gist is meant to show my current attempt at saving a Remix form that includes a file. It's a simplified version of the form. The file (an image) should be uploaded to Cloudfront (which then gets sent to an S3 bucket).

// app/routes/settings.tsx - Remix route

import { 
  unstable_composeUploadHandlers as composeUploadHandlers,
  unstable_createMemoryUploadHandler as createMemoryUploadHandler,
  unstable_parseMultipartFormData as parseMultipartFormData,
} from "@remix-run/node";
# Git Aliases
alias gl='git pull --prune'
alias rw='checkout -'
alias co='checkout'
alias ci='commit'
alias st='status'
@kauffmanes
kauffmanes / SO1.md
Created March 7, 2023 19:10
Stack Overflow Answer
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
// FILE #1: app/utils/session.ts
import jwt from 'jsonwebtoken';
import { redirect } from 'remix';
export function requireValidSession(request: Request) {
// assuming key is stored as base64
// if not, no need for this line, just use env var directly
const publicKey = Buffer.from(process.env.JWT_PUBLIC_KEY || '', 'base64').toString('ascii');
const tokenName = process.env.USERFRONT_TOKEN_NAME || '';
@kauffmanes
kauffmanes / ppa-server.md
Created May 28, 2020 17:33
Setting up a PPA Server

DON'T USE THIS YET - WORK IN PROGRESS

What's a PPA?

I've recently been trying out Electron.js for a number of new projects and it's so great to work with. It's useful for building desktop applications as advertised, but also for applications running in kiosk mode, such as an ATM screen or embedded GUI. The development of an Electron application is outside the scope of this article, but I'm mentioning it because that process outputted the .deb file that I'll using in this article.

So what is a PPA? PPA stands for Personal Package Archive and it's a way for developers to create source packages for Ubuntu that can be built and published as an apt repository. When you add your repository to your sources list, Ubuntu can perform updates just like any other Ubuntu package. If any of this sounds like a foreign language, I recommend reading this PPA Guide.

Setting up the Server

First you'll want to update your ins

@kauffmanes
kauffmanes / index.html
Created January 22, 2020 01:39
Exercise 1: Recipe Markup
<!doctype html>
<html>
<head>
<title>My Cookie Recipe</title>
<meta charset="utf-8" />
</head>
<body>
<h1>Best Chocolate Chip Recipe</h1>
<ul>
<li>1 cup butter, softened</li>
@kauffmanes
kauffmanes / create-robomaker-resources.sh
Last active January 17, 2020 00:09
Creating robomaker resources using the CLI
#!/bin/bash
set -e
echo "Enter the robot's serial number (ex. FX250123)"
read ROBOT_SN
if [ -z $ROBOT_SN ]
then
echo "A robot serial number is required."
exit
@kauffmanes
kauffmanes / FinalProject.ipynb
Created December 13, 2018 05:33
Final Project Jupyter Notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kauffmanes
kauffmanes / install_anaconda.md
Last active November 20, 2024 02:50
Install Anaconda on Windows Subsystem for Linux (WSL)

Thanks everyone for commenting/contributing! I made this in college for a class and I no longer really use the technology. I encourage you all to help each other, but I probably won't be answering questions anymore.

This article is also on my blog: https://emilykauffman.com/blog/install-anaconda-on-wsl

Note: $ denotes the start of a command. Don't actually type this.

Steps to Install Anaconda on Windows Ubuntu Terminal

  1. Install WSL (Ubuntu for Windows - can be found in Windows Store). I recommend the latest version (I'm using 18.04) because there are some bugs they worked out during 14/16 (microsoft/WSL#785)
  2. Go to https://repo.continuum.io/archive to find the list of Anaconda releases
  3. Select the release you want. I have a 64-bit computer, so I chose the latest release ending in x86_64.sh. If I had a 32-bit computer, I'd select the x86.sh version. If you accidentally try to install the wrong one, you'll get a warning in the terminal. I chose `Anaconda3-5.2.0-Li