Skip to content

Instantly share code, notes, and snippets.

Working from home

Trent Albright talbright

Working from home
View GitHub Profile

Keybase proof

I hereby claim:

  • I am talbright on github.
  • I am talbright ( on keybase.
  • I have a public key ASB_OJNsfti0Iy5-nnGOJKyJNTquqRQcQqKFFp0BtFzYFwo

To claim this, I am signing this object:

View gist:517775b2c7054df7c5f1
diff --git i/hieradata/environment/staging/desk_redis.yaml w/hieradata/environment/staging/desk_redis.yaml
index a80c901..7005017 100644
--- i/hieradata/environment/staging/desk_redis.yaml
+++ w/hieradata/environment/staging/desk_redis.yaml
@@ -1,5 +1,9 @@
desk_redis::configuration::redis_cluster_a_master: ' 6379'
+desk_redis::configuration::redis_cluster_a_master_host: ''
+desk_redis::configuration::redis_cluster_a_master_port: '6379'
desk_redis::configuration::redis_cluster_a_proxy: ' 6379'
View -
api_v2_jira_comments POST /api/v2/jira/comments(.:format) api/v2/jira/comments#create {:format=>"json"}
api_v2_jira_comment GET /api/v2/jira/comments/:id(.:format) api/v2/jira/comments#show {:format=>"json"}
api_v2_jira_attachments POST /api/v2/jira/attachments(.:format) api/v2/jira/attachments#create {:format=>"json"}
api_v2_jira_attachment GET /api/v2/jira/attachments/:id(.:format) api/v2/jira/attachments#show {:format=>"json"}
link_api_v2_jira_issues POST
View issue.json
"expand": "renderedFields,names,schema,transitions,operations,editmeta,changelog",
"id": "58224",
"self": "",
"key": "AA-27004",
"fields": {
"issuetype": {
"self": "",
"id": "1",
"description": "A problem which impairs or prevents the functions of the product.",
talbright / main.go
Last active Aug 29, 2015
Better martini error handler that supports 404 and 405 scenerios
View main.go
package main
import (
func generic() string {
talbright /
Created Feb 15, 2015
Sets file mtimes to latest git commit timestamp
# Ensures mtimes are consistent with the git commit to utilize ADD caching
# Re-written from
# This version is more platform compatible (assuming you have ruby), works on os x and *nix
git_set_mtimes() {
pushd $1
files=( $({ git ls-files | xargs dirname | sort -u && git ls-files; } | sort -r) )
unset IFS
for f in "${files[@]}"; do
stamp="$(git --no-pager log -1 --format='format:%ai' -- "$f")"
View yaml-integer-array-size.rb
#!/usr/bin/env ruby
require 'yaml'
require 'zlib'
starting_bound = 368_796_583
ending_bound = 999_999_999
integers = []
ARGV[0].to_i.times { |x| integers << rand(starting_bound..ending_bound) }
talbright / elasticsearch_transition.rb
Last active Aug 29, 2015
What to do when ruby gems use the same require path and conflict...
View elasticsearch_transition.rb
# config/initializers/elasticsearch_transition.rb
# Both elasticsearch-0.4.11 and rubberband-0.1.6 use 'elasticsearch'
# in their respective gem lib dirs. This causes the elasticsearch gem
# to incorrectly require same named paths from the wrong gem (in this
# case from rubberband). That's because rubberband is in the require
# path first.
# You have to set require: false in your Gemfile for the
# elasticsearch gems.
talbright / gist:96b28d31845e50d6fd1a
Last active Aug 29, 2015
Rails: check for fragment key outside of controller
View gist:96b28d31845e50d6fd1a
action_base =
key = "en/handlebars_ticket_filter_show_v2/ssl:false"
action_base.fragment_cache_key(key) # shows how Rails modifies the key before storage see ActiveSupport::Cache.expand_cache_key
talbright / _instrument.rb
Created Nov 14, 2014
Rails: instrument output of fragment caching for debugging
View _instrument.rb
# config/initializers
ActiveSupport::Notifications.subscribe /fragment.action_controller/ do |*args|
event = *args "Notification for event #{} with payload #{event.payload}"