Skip to content

Instantly share code, notes, and snippets.

View SkylerRogers's full-sized avatar

Skyler Rogers SkylerRogers

View GitHub Profile
@SkylerRogers
SkylerRogers / gist:cd7068a9e0d21a8f99e377bce0f285f3
Created February 24, 2017 13:38
Find Docker ID By Image Name
function find_docker_container() {
docker ps -q --filter ancestor=$1
}
##
## tinyproxy.conf -- tinyproxy daemon configuration file
##
## This example tinyproxy.conf file contains example settings
## with explanations in comments. For decriptions of all
## parameters, see the tinproxy.conf(5) manual page.
##
#
# User/Group: This allows you to set the user and group that will be
@SkylerRogers
SkylerRogers / why_i_love_ruby.rb
Last active August 29, 2015 14:25
Remembering Why I Love Ruby - Alphanumeric Sorting and Incrementing
["1a", "3", "1b", "2a", "3a", "2b", "1"].sort
"1a".next
"1az".next
"1aaz".next
@SkylerRogers
SkylerRogers / delete_resque_failures_by_date_time.rb
Last active August 29, 2015 14:17
Clean Out Old Resque Failures by Date
Resque::Failure.each do |f|
if Resque::Failure.all(f)["failed_at"].to_datetime.year < 2015
Resque::Failure.remove(f)
end
end
@SkylerRogers
SkylerRogers / mongoid_index_cleanup.rb
Created February 7, 2015 00:06
Delete Undefined Mongoid Indexes for Given Model
model = YourModel
current_index_keys = model.collection.indexes.entries.map{|x| x['key'].stringify_keys unless x['key'] == {"_id"=>1}}.compact
defined_index_keys = model.index_options.keys.map{|x| x.stringify_keys}
current_index_keys.each do |k|
model.collection.indexes.drop(k) unless defined_index_keys.include?(k)
end
@SkylerRogers
SkylerRogers / mongo_inspector.rb
Last active August 29, 2015 14:13
See all hits to MongoDB inside irb
# 1. Paste this in console
def show_mongo_db_operations
if Moped.logger == Rails.logger
Moped.logger = Logger.new($stdout)
true
else
Moped.logger = Rails.logger
false
end

Stephen's Shitlist

Person/Place/Thing Shit-storm level (tm)
Obama / Healthcare ![1][poo] ![2][poo] ![3][poo] ![4][poo] ![5][poo]
ERB and HAML templates ![1][poo] ![2][poo] ![3][poo] ![4][poo] ![5][poo]
Matt Newton Metaprogramming ![1][poo] ![2][poo] ![3][poo] ![4][poo] ![5][poo]
T-Mobile ![1][poo] ![2][poo] ![3][poo] ![4][poo] ![5][poo]
John ![1][poo]
Ruby Hash Rockets ![1][poo] ![2][poo] ![3][poo] ![4][poo] ![5][poo]