Skip to content

Instantly share code, notes, and snippets.

Dan McNevin dpmcnevin

Block or report user

Report or block dpmcnevin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View git-bump.rb
#!/usr/bin/env ruby
require 'git'
require 'logger'
g =
if ARGV.include?("-h") || ARGV.include?("--help")
puts <<-EOF
USAGE: git bump [options]
dpmcnevin / gist:48c0cf022fa0ca610e12
Created Oct 12, 2014
Set iTerm2 Background Color per Git Repo (zsh)
View gist:48c0cf022fa0ca610e12
set_color() {
local HEX_FG=$1
local HEX_BG=$2
local OPACITY=$3
local FG_R=`echo $HEX_FG | sed 's/../0x&,/g' | awk -F "," '{printf("%d",$1 * 257)}'`
local FG_G=`echo $HEX_FG | sed 's/../0x&,/g' | awk -F "," '{printf("%d",$2 * 257)}'`
local FG_B=`echo $HEX_FG | sed 's/../0x&,/g' | awk -F "," '{printf("%d",$3 * 257)}'`
local BG_R=`echo $HEX_BG | sed 's/../0x&,/g' | awk -F "," '{printf("%d",$1 * 257)}'`
local BG_G=`echo $HEX_BG | sed 's/../0x&,/g' | awk -F "," '{printf("%d",$2 * 257)}'`
dpmcnevin / pivotal.rb
Created Mar 30, 2011
Git post-receive hook to modify stories in Pivotal Tracker
View pivotal.rb
require 'rubygems'
require 'mail'
require 'pivotal_tracker'
require 'git'
class Pivotal
attr_reader :story, :project
View development.log
SQL (0.1ms) BEGIN
Issue Load (0.1ms) SELECT `issues`.* FROM `issues` WHERE (`issues`.`resolution` IS NULL) AND (`issues`.`description` = '') AND (`issues`.`name` = 'something') ORDER BY start_at DESC LIMIT 1
SQL (0.2ms) SELECT COUNT(*) AS count_id FROM `comments`
SQL (18.6ms) INSERT INTO `comments` (`body`, `commentable_id`, `commentable_type`, `created_at`, `updated_at`, `user_id`) VALUES ('Duplicate attempted to open', 3370, 'Issue', '2010-11-03 14:36:12', '2010-11-03 14:36:12', 1)
View operating_system.rb
class OperatingSystem < ActiveRecord::Base
belongs_to :host
t = OperatingSystem.arel_table
match_on = [:name,:version,:service_pack]
matches = {|m| "IF(#{t[m].matches("%#{term}%").to_sql},operating_systems.#{m.to_s},NULL)" }
matching_string = "CONCAT_WS(' ', #{matches.join(",")}) as matched_on"
View host.rb
class Host < ActiveRecord::Base
has_one :operating_system
attr_accessor :matched_on
View session_store.rb
Rails.application.config.session_store :cookie_store, {
:domain => '.rails.local',
:key => '_sso_session'
Rails.application.config.secret_token = 'the same really long hex string'
View session_store.rb
Rails.application.config.session_store :cookie_store, {
:domain => '.rails.local',
:key => '_sso_session',
:secret => 'the same really long hex string'
You can’t perform that action at this time.