Skip to content

Instantly share code, notes, and snippets.

@digitaljhelms
digitaljhelms / gist:4287848
Last active Jan 23, 2021
Git/GitHub branching standards & conventions
View gist:4287848

Branching

Quick Legend

Instance Branch Description, Instructions, Notes
@digitaljhelms
digitaljhelms / gist:3099010
Created Jul 12, 2012
Squash the first two commits in a git repository's history
View gist:3099010

The scenario

Your repository has two commits:

$ git log --oneline
957fbfb No, I am your father.
9bb71ff A long time ago in a galaxy far, far away....
@digitaljhelms
digitaljhelms / gist:3761873
Created Sep 21, 2012
Git/GitHub commit standards & conventions
View gist:3761873

Committing Code

General Rules

  • Make atomic commits of changes, even across multiple files, in logical units. That is, as much as possible, each commit should be focused on one specific purpose.
  • As much as possible, make sure a commit does not contain unnecessary whitespace changes. This can be checked as follows:
$ git diff --check
@digitaljhelms
digitaljhelms / gist:5247192
Last active Sep 17, 2020
A faster, less buggy alternative to "python -m SimpleHTTPServer"
View gist:5247192
$ npm install -g http-server
$ http-server -p 8000 -a foo.bar.com

Would serve PWD at http://foo.bar.com/

@digitaljhelms
digitaljhelms / api.json
Created Jul 13, 2012
A JSON formatted response containing all posts from a Jekyll blog
View api.json
[
{
"homepage": "http://digitaljhelms.github.com",
"name": "digitaljhelms",
"description": "finally blogging...",
"author": "Jeremy Helms",
"post": {
"url": "http://digitaljhelms.github.com/howto/creating-a-branch-with-no-parents-or-history",
"slug": "creating-a-branch-with-no-parents-or-history",
"title": "Create a Git Branch without Parents or History",
@digitaljhelms
digitaljhelms / .gitconfig
Last active Mar 13, 2020
My personal ~/.gitconfig file
View .gitconfig
[user]
name = Jeremy Helms
email = digitaljhelms@gmail.com
[alias]
aliases = !git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/ = /' | sort # list all aliases
cb = !git branch | grep ^* | cut -d' ' -f2
branch-name = !git cb # alias to "cb" alias
st = status
ci = commit
cie = commit --allow-empty-message -m ''
@digitaljhelms
digitaljhelms / gist:2931522
Created Jun 14, 2012
Building and installing Git from source on OS X Lion
View gist:2931522

Building and installing Git from source on OS X Lion

This outline for building and installing Git has only been tested against Mac OS X 10.7.x (Lion). While these steps may work for previous versions of Mac OS X, I cannot confirm this. Furthermore, you're on your own, if you screw something up, it's not my fault.

If you have Xcode 4, you have Git!

Xcode 4 includes the Git binary at the application level so it's available to itself (located at /Applications/Xcode.app/Contents/Developer/usr/bin/git). Additionally, Xcode 4 includes a new "Downloads" preference pane to install optional components, one of which are the Command Line Tools (similar to the Dev Tools package that shipped with older versions of Xcode) and once installed, Git (and many other utilities, such as make) is installed at the system level (located at /usr/bin).

*Note: You don't have to install Xcode to use the Command Line Tools; it can be downloaded independently from the Apple Developer site (you need to login, but it's free

@digitaljhelms
digitaljhelms / httpcode
Last active Aug 27, 2019
CLI to evaluate the HTTP Code for a list of URLs
View httpcode
#!/bin/bash
while IFS= read -r LINE || [ "$LINE" ]; do
# https://curl.haxx.se/docs/manpage.html
IN=$(curl -o /dev/null --silent --head --write-out "%{http_code};%{redirect_url}" "$LINE")
# https://stackoverflow.com/a/5257398
arrIN=(${IN//;/ })
if [ "${arrIN[0]}" = "301" ] || [ "${arrIN[0]}" = "302" ]; then
@digitaljhelms
digitaljhelms / post-rewrite
Created Sep 22, 2014
Git hook to call `git submodule update` automatically.
View post-rewrite
#!/bin/sh
echo "[post-rewrite hook: $1]"
# quick script to call "git submodule update" automatically if the
# .gitmodules file is changed
changedfiles=( `git diff-tree --no-commit-id --name-only HEAD@{1} HEAD` )
if [[ "${changedfiles[*]}" =~ ".gitmodules" ]]; then
echo "initializing & updating submodule(s)"
@digitaljhelms
digitaljhelms / disableinstantwatch.user.js
Last active Feb 22, 2019
Disable Netflix Instant Watch Links
View disableinstantwatch.user.js
// ==UserScript==
// @name Disable Netflix Instant Watch Links
// @namespace https://gist.github.com/6349351
// @description Click the cover image, go the video detail page, simple...
// @version 1.1
// @author Jeremy Helms <digitaljhelms@gmail.com>
// @include http://www.netflix.com/*
// @exclude http://www.netflix.com/WiPlayer/*
// ==/UserScript==