Skip to content

Instantly share code, notes, and snippets.

Love Coffee

Tommy Parnell TerribleDev

Love Coffee
Block or report user

Report or block TerribleDev

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
TerribleDev / TimeReporterPlugin.js
Created Nov 7, 2019
Webpack 4 plugin to measure how long an entry takes to build
View TimeReporterPlugin.js
const { performance, PerformanceObserver } = require('perf_hooks');
const PluginName = "TimeReporterPlugin";
class TimeReporterPlugin {
constructor(filterPattern = /HtmlWebpackPlugin|mini-css-extract-plugin/i) {
this.FilterPattern = filterPattern;
apply(compiler) {
let _timeEvents = [];
TerribleDev / Img.js
Created Oct 12, 2019
A component to render responsive images in gatsby
View Img.js
import React from "react"
import { useStaticQuery, graphql } from "gatsby"
import Img from "gatsby-image"
const Image = ({ imgName }) => {
const data = useStaticQuery(graphql`
query images {
allFile(filter: { sourceInstanceName: { eq: "images" } }) {
nodes {
View lazyLoadImages.js
if(window.IntersectionObserver) {
document.addEventListener("DOMContentLoaded", function() {
var lazyImages = []".lazy"));
var lazyImageObserver = new IntersectionObserver(function(entries, observer) {
entries.forEach(function(entry) {
if (entry.isIntersecting) {
var lazyImage =;
if(lazyImage.dataset.src) {
lazyImage.src = lazyImage.dataset.src;
TerribleDev /
Created Apr 30, 2019
force reinstall of node
brew uninstall --ignore-dependencies node@10
brew uninstall --ignore-dependencies node
brew uninstall --ignore-dependencies yarn
brew uninstall --ignore-dependencies icu4c
brew install node@10
brew install --ignore-dependencies yarn
brew link --overwrite --force node@10
brew link --overwrite yarn
TerribleDev /
Created Apr 18, 2019
run checkstyle as git hook when java files have changed
javaCount=`git diff --cached --name-status | grep -i .java | wc -l | awk '{print $1}'`
if [ $javaCount -eq 0 ];
exit 0
exec ~/cargurus/cg-main/cargurus-build/local/devbox-push/
TerribleDev / TargetLinkExtension.cs
Created Jan 22, 2019
A markdig extension so add target blank to absolute urls
View TargetLinkExtension.cs
public class TargetLinkExtension : IMarkdownExtension
public void Setup(MarkdownPipelineBuilder pipeline)
public void Setup(MarkdownPipeline pipeline, IMarkdownRenderer renderer)
var htmlRenderer = renderer as HtmlRenderer;
TerribleDev / createMarkedSelector.js
Last active Jan 15, 2019
Wrap reselect's createSelector with a function that measures how long selectors take to run
View createMarkedSelector.js
import {createSelector} from 'reselect';
const hasPerformanceApi =
window &&
window.performance &&
window.performance.measure &&
const createFuncWithMark = (name, callback) => (...args) => {
const startMark = `${name}-Startmark`;
TerribleDev / replace
Created Jan 2, 2019
Regex to Replace createSelector with createMarkedSelector
View replace
TerribleDev /
Created Dec 14, 2018
put exit codes in shell
# Custom bash prompt via
export PS1="\[$(tput bold)\]\$?|\[$(tput setaf 1)\][\[$(tput setaf 3)\]\u\[$(tput setaf 2)\]@\[$(tput setaf 4)\]\h \[$(tput setaf 5)\]\W\[$(tput setaf 1)\]]\[$(tput setaf 7)\]\\$ \[$(tput sgr0)\]"
TerribleDev / ConsoleAppenderExample.cs
Created Oct 7, 2017
The console appender example from apache's log4net site
View ConsoleAppenderExample.cs
#region Apache License
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to you under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
You can’t perform that action at this time.