Skip to content

Instantly share code, notes, and snippets.

View dgrebb's full-sized avatar

Dan Grebb dgrebb

View GitHub Profile
@dgrebb
dgrebb / +page.svelte
Created June 18, 2023 22:12
Parse markdown via `SvelteMarkdown` passing a custom `Link` component as renderer to add `target="_blank"` and `"rel=nofollow noopener noreferrer"` to external links in markdown
<script>
import SvelteMarkdown from 'svelte-markdown'
import Link from "../components/markdown/Link.svelte";
export let data;
const { title } = data;
</script>
<SvelteMarkdown
@dgrebb
dgrebb / gist:8ac1bbf2d086d110f0cd8e81b0252adc
Created February 3, 2020 16:30
export list of git contributors
git log --no-merges --since='01-01-2019' --pretty=format:%h,%ad,%an,%ae,%s > history.csv
@dgrebb
dgrebb / docker-destroy-all.sh
Created April 27, 2019 22:26 — forked from JeffBelback/docker-destroy-all.sh
Destroy all Docker Containers and Images
#!/bin/bash
# Stop all containers
docker stop $(docker ps -a -q)
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
@dgrebb
dgrebb / .gitaliases
Created September 6, 2018 19:45
Aliases for use with Git.
#
# Aliases
# (sorted alphabetically)
#
alias g='git'
alias ga='git add'
alias gaa='git add --all'
alias gapa='git add --patch'
@dgrebb
dgrebb / _README.md
Last active September 21, 2017 15:04
webpack version plugin

Define a webpack plugin that pulls version information from package.json.

# SYNTAX:
var pattern = new RegExp(pattern, attributes); # attributes: g (global); i (case-sensitive); m (multiline matches)
var pattern = /pattern/attributes; # same as above
# BRACKETS:
[...]: Any one character between the brackets.
[^...]: Any one character not between the brackets.
@dgrebb
dgrebb / index.js
Created June 26, 2017 15:05
BrowserStack Automate Test Local Example
/**
# bash
# Mac-specific
cd /Applications
./BrowserStackLocal --key [your browserstack key] --local-identifier PatternLab
*/
var webdriver = require('selenium-webdriver'),
By = webdriver.By;
@dgrebb
dgrebb / video-playback-onscroll.js
Created June 15, 2017 15:19
viewport scroll in/out event
/**
* Play or pause video based on visibility in window viewport.
*
* @param {any} video The video element.
*
* @memberof TabbedVideo
*/
toggleVideoPlayback(video) {
var windowHeight = window.innerHeight,
@dgrebb
dgrebb / AutoHotKey for a Mac User with an Apple keyboard on Windows.ahk
Last active September 18, 2023 18:20 — forked from chrisfcarroll/AutoHotKey for a Mac User with PC keyboard on Windows.ahk
AutoHotKey script for they who, being Mac Users with an Apple keyboard, yet still insist on using Windows. Also some arrange-windows-on-a-big-screen keys . Takes a similar approach as Parallels to keyboard mapping: rather than a wholesale swap of Cmd <-> Ctrl, instead duplicate favourite ctrl-key shortcuts to the Cmd key. For the big screen: som…
#InstallKeybdHook
; Language: English
; https://gist.github.com/chrisfcarroll/dddf32fea1f29e75f564
;
; Uses unicode. Save this file as utf-8 with BOM.
; Else it shall not work.
;
#NoEnv ; Recommended
;SendMode Input ; Recommended
### Git Time
# Add this to your .oh-my-zsh theme if you're using those, or directly to your zsh theme :)
# Colors vary depending on time lapsed.
ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}"
ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}"
ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}"
ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}"