Skip to content

Instantly share code, notes, and snippets.

View brawlins's full-sized avatar

Brett Rawlins brawlins

  • Salt Lake City, UT
View GitHub Profile
@brawlins
brawlins / pruneLocalBranches.sh
Last active May 10, 2024 17:27
Shell script that deletes local git branches that were deleted on the remote
#!/bin/zsh
# Deletes local branches that have been deleted on the remote
function pruneLocalBranches {
# Get the main branch name (the one checked out on the remote)
mainBranch=$(git rev-parse --abbrev-ref origin/HEAD | cut -d "/" -f 2)
# Check out that branch because it should never get pruned
git checkout $mainBranch &> /dev/null
@brawlins
brawlins / SvgIcon.js
Last active February 2, 2016 15:18
React component for using SVG icons in your application.
"use strict";
var React = require('react');
/**
* SVG icon component
*
* Renders an icon with the given symbol id. Assumes you have a SVG definitions
* document with symbols defined. React sometimes chokes on SVGs defined in
* JSX, so a workaround is to wrap it in a tag and set the inner HTML of that