Skip to content

Instantly share code, notes, and snippets.

View digitaljhelms's full-sized avatar

Jeremy Helms digitaljhelms

  • USA
View GitHub Profile
@digitaljhelms
digitaljhelms / gist:3125794
Created July 16, 2012 23:26
Bash CLI function to change the file extension for multiple files at once
# bash function, usage: $ ext [ext1] [ext2]
function ext() {
for f in *.$1; do mv $f `basename $f .$1`.$2; done;
}
@digitaljhelms
digitaljhelms / sass_converter.rb
Created July 16, 2012 23:18 — forked from wolfeidau/sass_converter.rb
Sass plugin for Jekyll
module Jekyll
# Sass plugin to convert .scss to .css
#
# Note: This is configured to use the new css like syntax available in sass.
class SassConverter < Converter
safe true
priority :low
def setup
return if @setup
@digitaljhelms
digitaljhelms / api.json
Created July 13, 2012 23:44
A JSON formatted response containing all posts from a Jekyll blog
[
{
"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 / gist:3099010
Created July 12, 2012 15:58
Squash the first two commits in a git repository's history

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:3061914
Created July 6, 2012 18:35
Removing content/items from an array
/*
* When you delete an array element using the delete
* operator, the array length is not affected. For example
* if you delete arr[2], arr[3] is still arr[3] and arr[2]
* is undefined.
*/
arr = ['a', 'b', 'c', 'd']
// ["a", "b", "c", "d"]
delete arr[2]
@digitaljhelms
digitaljhelms / gist:3014302
Created June 28, 2012 22:08
Sublime Text 2 bash alias & CLI function to open projects without using the `.sublime-project` file extension
# bash alias
alias subl='/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl'
# bash function, usage: $ st -p [projectname] -opt2 -opt3
function st() {
if [ -n "$1" -a -n "$2" ]; then # if more than one argument
if [ "$1" = "-p" -o "$1" = "--project" ]; then # if arg1 is -p or --project
local projectfile="$2"
[[ $projectfile != *.sublime-project ]] && projectfile="$2.sublime-project" # detect if arg2 already includes the ext
if [ -e $projectfile ]; then # does project file exist?
@digitaljhelms
digitaljhelms / gist:2931522
Created June 14, 2012 17:07
Building and installing Git from source on OS X Lion

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 / gist:2052887
Created March 16, 2012 21:35
Clean up the Google Music/Play UI
#oneGoogleWrapper {
display: none;
}
#headerBar #promo_pack_bar {
display: none !important;
}
#main #start-page-recommendations-container {
display: none !important;
}
@digitaljhelms
digitaljhelms / gist:1480257
Created December 15, 2011 07:48
git fetch output flags

Output flags returned by git fetch (based on git version 1.7.8):

*Also note that in fast-forwards, the output contains ".."

@digitaljhelms
digitaljhelms / gist:1420264
Created December 1, 2011 22:10
Create a globally accessible "lg" alias for a more robust git-log command
git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative --all --decorate=full"