Skip to content

Instantly share code, notes, and snippets.

gtd / coverage_checker.rb
Created Sep 20, 2015
This class returns a set of *.rb files which are not present in a SimpleCov resultset
View coverage_checker.rb
# This class returns a set of *.rb files which are not present in a SimpleCov resultset
require 'json'
require 'set'
class CoverageChecker
def missed_files(dir = 'app')
gtd / honeybadger-users.rb
Created Mar 10, 2015
review honeybadger error users
View honeybadger-users.rb
api_key = 'KqdN3zU5csyXqoEExjMx'
ma_project_id = '40406'
no_viewing_fault_id = '9518398'
project_id = ma_project_id
fault_id = no_viewing_fault_id
notices_url = "{project_id}/faults/#{fault_id}/notices?auth_token=#{api_key}"

Keybase proof

I hereby claim:

  • I am gtd on github.
  • I am gtd ( on keybase.
  • I have a public key whose fingerprint is 6A21 777F D1B1 978E E1C4 56CF 6216 0416 3F17 C9CF

To claim this, I am signing this object:

View random_code.rb
module RandomCode
extend self
def generate(size = 8)
charset = %w{ 2 3 4 6 7 9 A C D E F G H J K M N P Q R T U V W X Y Z }
(0...size).map{ charset[SecureRandom.random_number(charset.size)] }.join
function rt {
if [ $# -le 1 ] ; then
echo Running: ruby -Itest $1
ruby -Itest $1
if [ $param = 'test/' ] ; then # Assumes all test files are in test/**
while [ "$1" != "" ]; do
if [ ! $test_files ]; then
gtd /
Created Nov 20, 2013
Extract Default Rails Log Request Entries
awk '
/^Started .+ "\/services\/samsung/ {printf("\n");flag=1}
flag {print}
/^Completed /{flag=0}
' production.log
cat production.log | awk '
/^Started PUT "\/staged\/films\/.*\/still"/ {printf("\n");flag=1}
flag {print}
/^ User ID: /{flag=0}
gtd / simple_redis_profile.rb
Created Sep 29, 2011 — forked from joeyAghion/simple_redis_profile.rb
By sampling keys from your redis databases, this script tries to identify what types of keys are occupying the most memory.
View simple_redis_profile.rb
#!/usr/bin/env ruby
# Evaluates a sample of keys/values from each redis database, computing statistics for each key pattern:
# keys: number of keys matching the given pattern
# size: approximation of the associated memory occupied (based on size/length of value)
# percent: the proportion of this 'size' relative to the sample's total
# Copyright Weplay, Inc. 2010. Available for use under the MIT license.
View longest_palindrome_finder.rb
class PalindromeFinder
def initialize(string)
@input = string
def longest
max, out = 0, ''
@input.chars.to_a.each_index do |i|
index, length = max_palindrome(i)
max, out = [length, @input[index, length]] if length > max