Skip to content

Instantly share code, notes, and snippets.

View jasonsbarr's full-sized avatar

Jason Barr jasonsbarr

  • Evansville, Indiana
View GitHub Profile
@jasonsbarr
jasonsbarr / Component.js
Last active December 13, 2021 17:08
React hook to render data from a GET request using `fetch` based on states of a Promise lifecycle
import { useFetchGet } from "../hooks";
import ResolvedComponent from "./";
/**
* Example use case
* @see [Use in an actual project]{@link https://github.com/jasonsbarr/Sprint-Challenge-Single-Page-Apps/blob/d379e83f5d2bb77566d5fd37bbf2d5812438417d/src/pages/Characters.js|Github}
*/
const Component = () => {
const render = useFetchGet(url);
@jasonsbarr
jasonsbarr / bootstrap4.code-snippets
Last active October 21, 2018 19:08
VS Code snippets for Bootstrap 4: starter template (with app.css/app.js), components, and css and script tag-only snippets (CDN for CSS & JS)
{
"Bootstrap 4 full": {
"scope": "html",
"prefix": "boot4",
"body": [
"<!doctype html>",
"<html lang=\"en\">",
"<head>",
"\t<!-- Required meta tags -->",
"\t<meta charset=\"utf-8\">",
@jasonsbarr
jasonsbarr / states.json
Last active July 4, 2018 01:58
JSON-formatted list of all 50 states plus D.C. as an array
{
"name": "jasonsbarr/states-list",
"description": "JSON-formatted list of all 50 states plus D.C.",
"dateCreated": "7/2/2018",
"dateLastEdited": "7/3/2018",
"author": "Jason Barr",
"email": "jason@jasonsbarr.com",
"license": "Public Domain",
"states": [
{"abbreviation": "AL", "name": "Alabama"},
@jasonsbarr
jasonsbarr / phinx.php
Created March 23, 2018 14:31
PHP config for robmorgan/phinx that loads .env variables via Dotenv
<?php
/**
* This assumes phinx.php and .env are both in the project root
*/
require __dir__ . '/vendor/autoload.php';
Dotenv::load(__dir__);
$defaultDatabase = getenv('APP_ENV');
return [