Skip to content

Instantly share code, notes, and snippets.

View JeremyBernier's full-sized avatar

Jeremy Bernier JeremyBernier

View GitHub Profile
@JeremyBernier
JeremyBernier / gist:6fb95d7c3496f6383decac1669ff0df5
Created October 19, 2022 20:36
TailwindCSS Components - React
import { useState } from "react";
import type { NextPage } from "next";
import Head from "next/head";
const CloseIcon = () => (
<svg
aria-hidden="true"
className="w-5 h-5"
fill="currentColor"
viewBox="0 0 20 20"
@JeremyBernier
JeremyBernier / google-cloud-deploy.js
Last active January 30, 2023 19:16
Deploy to Google Cloud Run with Environment Variables
/**
* Update: I just use this script to generate the terminal command, then I copy & paste
* that command into the terminal and run it manually.
* The reason I don't run the command from the script is that it wasn't properly erroring out
* from the script. You can uncomment the `exec(` function if you want to execute from
* this script though
*
* This script deploys to Google Cloud Run while also updating environment variables
* Note: This will fail if there are any double quotes (") in your environment variables
* Also this script won't delete environment variables that've already been pushed
@JeremyBernier
JeremyBernier / typeorm-upsert.ts
Created February 5, 2020 23:39
TypeORM upsert
import { getRepository, InsertResult } from "typeorm";
/**
* Upsert for TypeORM on PostgreSQL
* Returns InsertResult object (contains ID)
* @param repo Repository
* @param {object | object[]} data Data to upsert. Can be object or array
* @param {string} primaryKey Name of column that is primary key
* @returns {Promise<InsertResult>}
*/