Skip to content

Instantly share code, notes, and snippets.

View djm's full-sized avatar

Darian Moody djm

View GitHub Profile
@djm
djm / remove_tags.sh
Created March 8, 2017 12:38 — forked from hugorodgerbrown/remove_tags.sh
Git - remove all remote tags
# removes all tags from a git remote
# 1. `git ls-remote --tags origin` - lists all the tags at origin: '<hash> refs/tags/<tag>'
# 2. `awk '/^(.*)(\s+)(.*[a-zA-Z0-9])$/ {print ":" $2}'` - extract the ':/ref/tags/<tag>' from each
# 3. `xargs git push origin` - run 'git push origin :/ref/tags/<tag>' against each tag
git ls-remote --tags origin | awk '/^(.*)(\s+)(.*[a-zA-Z0-9])$/ {print ":" $2}' | xargs git push origin
@djm
djm / bookmarklets.js
Created September 26, 2016 13:22 — forked from Geekfish/bookmarklets.js
Trello Card bookmarklets
// Get Card's last URL segment (eg 4468-fix-the-login-page):
javascript:(function(s){try{s=document.selection.createRange().text}catch(_){s=document.getSelection()}prompt('', window.location.href.split("/").pop().split("#")[0])})()
// Get Card's full hash (eg 5731b92ef660293533517de9) :
javascript:(function(s){try{s=document.selection.createRange().text}catch(_){s=document.getSelection()}$('.js-more-menu').click(); prompt('', $('.js-export-json').attr('href').split("/")[2]); $('.js-more-menu').click();})()
// Get Card's unique id (board-independent, eg rKBmQeOk) :
javascript:(function(s){try{s=document.selection.createRange().text}catch(_){s=document.getSelection()}$('.js-more-menu').click(); prompt('', $('.js-short-url').attr('value').split("/").slice(-1)[0]); $('.js-more-menu').click();})()
@djm
djm / pre-commit.py
Created September 21, 2016 13:53 — forked from Geekfish/pre-commit.py
Pre-commit hook with flake8 and auto-named migrations
#!/usr/bin/env python
import sys, subprocess, collections
from flake8.hooks import git_hook, get_git_param
# `get_git_param` will retrieve configuration from your local git config and
# then fall back to using the environment variables that the hook has always
# supported.
# For example, to set the complexity, you'll need to do:
# git config flake8.complexity 10
COMPLEXITY = get_git_param('FLAKE8_COMPLEXITY', 10)