Skip to content

Instantly share code, notes, and snippets.

@jordelver
jordelver / gist:4594114
Created January 22, 2013 12:04
Git - Delete multiple remote branches

Git - Delete multiple remote branches

Delete all remote branches matching hotfix

git branch -r | grep hotfix | sed 's/origin\///' | xargs -I {} git push origin :{}
@jordelver
jordelver / postgres_queries_and_commands.sql
Created February 27, 2020 13:38 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@jordelver
jordelver / gist:4352220
Created December 21, 2012 11:18
Move a deprecated gem into vendor/gems

Move a deprecated gem into vendor/gems

If a gem gets pulled from rubygems.org, but you still have it locally (or can get hold of it somehow), you can move the gem into your vendor/gems directory.

Unpack the gem into vendor/gems

gem unpack <gem-name> --target vendor/gems

Edit the Gemfile to match

@jordelver
jordelver / gist:3149041
Created July 20, 2012 06:26 — forked from igrigorik/gist:3148848
Convert any YouTube video into an audio file you can listen to on the go...
# Convert any YouTube video into an audio file you can listen to on the go, using:
# http://rg3.github.com/youtube-dl/
{ ~ } > brew install ffmpeg
{ ~ } > brew install ffprobe
{ ~ } > wget https://raw.github.com/rg3/youtube-dl/2012.02.27/youtube-dl
{ ~ } > chmod u+x youtube-dl
# Pick which video format you want to download.. (use any YT video link)
@jordelver
jordelver / after.rb
Created July 6, 2012 16:03 — forked from mperham/after.rb
Thread-friendly shared connection
class ActiveRecord::Base
mattr_accessor :shared_connection
@@shared_connection = nil
def self.connection
@@shared_connection || ConnectionPool::Wrapper.new(:size => 1) { retrieve_connection }
end
end
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection
@jordelver
jordelver / das_download.rb
Created June 16, 2012 22:20 — forked from maca/das_download.rb
Script to download all Destroy All Software screencasts, account needed
#! /usr/bin/env ruby
# usage:
# $ das_download.rb email password [download_directory]
require 'mechanize'
# gem 'mechanize-progressbar'
email = ARGV[0] or raise('Please provide the email address for your account')
password = ARGV[1] or raise('Please provide the password for your account')
path = ARGV[2] || './'
@jordelver
jordelver / a.rb
Created May 10, 2012 07:22 — forked from ahoward/a.rb
style is the only thing.
# shitty
attributes[:name] = options[:name] unless options[:name].blank?
attributes[:first_name] = options[:first_name] unless options[:first_name].blank?
attributes[:last_name] = options[:last_name] unless options[:last_name].blank?
attributes[:linkedin_id] = options[:linkedin_id] unless options[:linkedin_id].blank?
attributes[:company] = options[:company] unless options[:company].blank?
attributes[:company_id] = options[:company_id] unless options[:company_id].blank?
attributes[:linkedin_picture_url] = options[:linkedin_picture_url] unless options[:linkedin_picture_url].blank?
@jordelver
jordelver / dependency_injection.rb
Created July 21, 2012 09:39 — forked from jferris/dependency_injection.rb
Dependency Injection in Ruby
module TaxCodeStrategies
class UnitedStates
def call(id)
"US-#{id}"
end
end
class Brazil
def call(id)
"#{id}-BR"
@jordelver
jordelver / quiz-1.md
Created October 4, 2012 20:00 — forked from ahoward/quiz-1.md
quiz-1.md
So you think you wanna be a web developer...

Fork this, update your copy with answers.

They don't need to be precise - pseudo-code is fine in most cases.

Some questions don't have correct answers.

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application: