Skip to content

Instantly share code, notes, and snippets.

View dgiunta's full-sized avatar

Dave Giunta dgiunta

View GitHub Profile
@dgiunta
dgiunta / git-safe-delete-branch-report
Created May 5, 2014 16:28
This little script uses the git-branch-report command but creates a report showing the commands to delete local branches that have already been merged into master.
#!/usr/bin/env ruby
require 'optparse'
options = {}
OptionParser.new do |opts|
opts.banner = "Usage: git-safe-delete-branch-report [options]"
opts.on("--porcelain", "Output machine-readable output") do |v|
@dgiunta
dgiunta / git-branch-report
Created May 5, 2014 16:26
This little script essentially spits out a nicely formatted report from running git branch --contains <branch> on your local repository. You might use this script if you wanted to see which branches have been merged into master already.
#!/usr/bin/env ruby
require 'optparse'
options = {}
OptionParser.new do |opts|
opts.banner = "Usage: git-branch-report [options]"
opts.on("--porcelain", "Output machine-readable output") do |v|
# Objective: Split the alphabet in half.
# Here's our range of letters.
letters = ('a'..'z').to_a
# Because we know what all the letters in the alphabet is,
# and subsequently what the middle letter actually is, we can
# use the handy Enumerable#partition method to achieve the results
# we're after.
letters.partition { |letter| letter <= 'm' }
@dgiunta
dgiunta / git-track
Created January 26, 2010 22:53 — forked from sstephenson/git-track
git-track
#!/bin/sh
branch=$(git branch 2>/dev/null | grep ^\*)
[ x$1 != x ] && tracking=$1 || tracking=${branch/* /}
git config branch.$tracking.remote origin
git config branch.$tracking.merge refs/heads/$tracking
echo "tracking origin/$tracking"
# Factory girl, relaxed.
#
# Factory.define :user do |f|
# f.login 'johndoe%d' # Sequence.
# f.email '%{login}@example.com' # Interpolate.
# f.password f.password_confirmation('foobar') # Chain.
# end
#
# Factory.define :post do |f|
# f.user { Factory :user } # Blocks, if you must.
// ==UserScript==
// @name ExecutiveSummary
// @namespace http://fluidapp.com
// @description What does this do?
// @include *
// @author Dave Giunta
// ==/UserScript==
(function () {
if (window.fluid) {
var SubCategoryDisplay = (function() {
function Thumb (element, container) {
var element = $(element);
var _selected = element.hasClass('selected');
var image = function() {
var parts = $('img', element).attr('src').split(/\//)
return {
filename: parts[parts.length-1].split(/\?/)[0],
id: parts[3]
}
PROMPT='%{$fg[cyan]%}%n %{$fg[green]%}%c %{$fg[yellow]%}$(git_prompt_info)%{$fg[yellow]%}
%# % %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="["
ZSH_THEME_GIT_PROMPT_SUFFIX=""
ZSH_THEME_GIT_PROMPT_DIRTY="] %{$fg[red]%}•%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="]"
PROMPT='%{$fg[cyan]%}%n %{$fg[green]%}%c %{$fg[yellow]%}$(git_prompt_info)%{$fg[yellow]%} % %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="["
ZSH_THEME_GIT_PROMPT_SUFFIX=""
ZSH_THEME_GIT_PROMPT_DIRTY="] %{$fg[red]%}•%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="]"
// only outputs if console available and does each argument on its own line
function log() {
if (window && window.console && window.console.log) {
var i, len;
for (i=0, len=arguments.length; i<len; i++) {
console.log(arguments[i]);
}
}
}