Skip to content

Instantly share code, notes, and snippets.

View franklinharvey's full-sized avatar
👨‍🌾
out on the farm

Franklin H franklinharvey

👨‍🌾
out on the farm
View GitHub Profile
@franklinharvey
franklinharvey / Rectangle Comparison.md
Created January 5, 2018 17:43
A comparison of 100x100 rectangles from Illustrator, Sketch, and Figma in SVG format.

Illustrator:

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
	 viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
<g>
	<path d="M99,1v98H1V1H99 M100,0H0v100h100V0L100,0z"/>
</g>
@franklinharvey
franklinharvey / force_empty_trash.sh
Last active August 19, 2018 02:00 — forked from emotality/force_empty_trash.sh
Force empty Trash after placing Time Machine backups in trash, for all volumes in OSX (including connected drives).
#!/bin/bash
#### Created by Jean-Pierre Fourie
#### Editted by Franklin Harvey
### https://github.com/emotality
### https://github.com/franklinharvey
## force_empty_trash.sh
#
clear
echo " "
@franklinharvey
franklinharvey / FullJitter.ts
Last active May 3, 2020 00:44
Full Jitter Exponential Backoff Algorithm
const BASE_TIMEOUT = 5 // in milliseconds, you can change this
const getTimeout = (attempt: number): number => {
const backoff = BASE_TIMEOUT * Math.pow(2, attempt) // exp. increases the timeout per attempt
const backoff_or_cap = Math.min(1000, backoff) // cap the timeout at 1 sec.
const ret = sample([0, backoff_or_cap]) // randomly choose between 0 and the backoff, this is the "jitter" part
return ret
}
// randomly choose from an array, a replacement of lodash's sample method
const sample = (arr: number[]) => {

Keybase proof

I hereby claim:

  • I am franklinharvey on github.
  • I am frankfrank (https://keybase.io/frankfrank) on keybase.
  • I have a public key ASB-O9aIr7bp-ZeNwSB92ZxTep-Gy_FklxWGVeOgto-cWAo

To claim this, I am signing this object:

@franklinharvey
franklinharvey / minified.js
Last active December 6, 2020 20:21
I needed to transform dates in an HTML file to be in "MMM YYYY" format without using any dependencies. This is how I did it using vanilla JS. This can be pasted directly into a dev-tools console to test.
const dateFields=document.getElementsByClassName("blog-date"),monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"],transformDate=e=>{const t=new Date(e.innerHTML);return`${t.getDate()} ${monthNames[t.getMonth()]} ${t.getFullYear()}`};dateFields.forEach(e=>{e.innerHTML=transformDate(e)});
@franklinharvey
franklinharvey / DraggableMarker.md
Last active January 7, 2021 18:05
Google Maps API v3.0 and react-google-maps snippets

Kind of a barebones approach to draggable markers, saving the new position in state By Franklin Harvey

interface MarkerProps {
    position: google.maps.LatLng
    onDragMarker(e: google.maps.MouseEvent): void
}