Skip to content

Instantly share code, notes, and snippets.

View pcast01's full-sized avatar

Paul pcast01

View GitHub Profile
@pcast01
pcast01 / ffCAC.md
Created February 10, 2020 20:22 — forked from fpigeonjr/ffCAC.md
Firefox CAC Setup

Firefox CAC Setup

This guide assumes you are using a 64 bit edition of Firefox.

Steps

  1. Click on the hamburger menu and select Options imgur
  2. Select Privacy & Security in the left navigation
  3. Select Security Devices button at the bottom of the page
@pcast01
pcast01 / Gatsby-bootstrap-lifecycle.md
Created November 27, 2019 01:35 — forked from swyxio/Gatsby-bootstrap-lifecycle.md
Gatsby bootstrap lifecycle

Sequence of Gatsby's bootstrap lifecycle with links to source code as of v2.0.0

  1. open and validate gatsby-config (get-config-file.js) 1.5 load themes (swyx added this note July 2019)
  2. load plugins (load-plugins/index.js) from the list given in gatsby-config.js
  3. onPreBootstrap: runs onPreBootstrap if it is implemented in any plugins, for example gatsby-plugin-typography. Receives handy [apiCallArgs](https://github.com/gatsbyjs/gatsby/blob/ffd8b2d691c9
@pcast01
pcast01 / useSearch.js
Created March 2, 2019 18:43 — forked from chrisdhanaraj/useSearch.js
A network request thing
// useSearch file
import React, { useEffect } from "react";
import axios from "axios";
import { useImmerReducer } from "./useImmerState";
import { baseSelectedItems } from "../constants";
export function useSearch(selectedItems) {
function reducer(draft, action) {
switch (action.type) {
@pcast01
pcast01 / js-oneliner.js
Last active April 28, 2019 15:10 — forked from hk-skit/js-oneliner.js
Useful Array One-liners and other js tips
// Remove Duplicates from an array
const removeDuplicates =
arr => arr.filter((item, index) => index === arr.indexOf(item));
const removeDuplicates1 = array => [...new Set(array)];
const removeDuplicates2 = array => Array.from(new Set(array));
// Flattens an array(doesn't flatten deeply).
@pcast01
pcast01 / set-up-chromium-keys.md
Created February 20, 2019 15:22 — forked from cvan/set-up-chromium-keys.md
Launch Chromium with API Keys on Mac OS X and Windows

Sometimes you need to use API Keys to use things like the Speech API. And then you Google a bit and follow all the instructions. But the Chromium Project's API Keys page does a not-so-great of explaining how to do this, so I will.

  1. Download Chromium.
  2. You'll notice a yellow disclaimer message appear as a doorhanger: Google API Keys are missing. Some functionality of Chromium will be disabled. Learn More.
  3. Clicking on that link takes you to the confusing API Keys docs page.
  4. If you aren't already, subscribe to the chromium-dev@chromium.org mailing list. (You can just subscribe to the list and choose to not receive any mail. FYI: the Chromium project restricts the APIs to those subscribed to that group - that is, Chromium devs.)
  5. Make sur
@pcast01
pcast01 / bandPractice.md
Last active July 5, 2019 22:09 — forked from fpigeonjr/bandPractice.md
Band Practice
@pcast01
pcast01 / 0_reuse_code.js
Created September 2, 2017 16:55
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@pcast01
pcast01 / GA-sort-two-columns.js
Created February 16, 2017 22:18 — forked from sco-tt/GA-sort-two-columns.js
This Google Apps Script sorts two columns. Variables can be modified to define what two columns should be sorted, and whether they should be ascending or descending.
/** Build a menu item
From https://developers.google.com/apps-script/guides/menus#menus_for_add-ons_in_google_docs_or_sheets
**/
function onOpen(e) {
var menu = SpreadsheetApp.getUi().createMenu('Sort');
if (e && e.authMode == ScriptApp.AuthMode.NONE) {
// Add a normal menu item (works in all authorization modes).
menu.addItem('Sort Sheet', 'sort');
} else {
@pcast01
pcast01 / FormSubmitFallback.gs
Created February 14, 2017 15:27 — forked from erickoledadevrel/FormSubmitFallback.gs
Demonstrate how to create a form submit processing script that can handle missing or duplicate trigger firings.
// Change this values based on your spreadsheet.
var SHEET_NAME = 'Form Responses 1';
var STATUS_COLUMN_NUMBER = 4;
var PROCESSED_STATUS = 'Processed';
var LAST_ROW_KEY = 'lastRow';
var LOCK_TIMEOUT_MS = 60000; // 1 minute
var MAX_RUNTIME_MS = 240000; // 4 minutes
/**