Skip to content

Instantly share code, notes, and snippets.

View ntalbott's full-sized avatar
💻
Writing and Coding

Nathaniel Talbott ntalbott

💻
Writing and Coding
View GitHub Profile
@ntalbott
ntalbott / .gitignore
Created February 16, 2012 19:06
Downloads all of your Basecamp files for archiving
exports
#!/usr/bin/env ruby
CASES = {
"" => ["", "", "", "", ""],
"Some random data." => ["Some random data.", "", "", "", ""],
"This information should be ignored RECORD_NUM 02 This is the information for record 2 RECORD_NUM 01 This is the information for record 1 RECORD_NUM 04 This is the information for record 4" =>
[" This is the information for record 1 ", " This is the information for record 2 ", "", " This is the information for record 4", ""],
}
def process(input, expected_record_count=5)
@ntalbott
ntalbott / hipchat-transcript
Created January 25, 2013 15:54
A handy little script to create a text-based transcript from a Hipchat room.
#!/usr/bin/env ruby
require "httparty"
def usage!
puts "Usage: hipchat-transcript <token> <room id> [date]"
exit!
end
TOKEN = (ARGV[0] || usage!)
@ntalbott
ntalbott / operable-software.md
Last active December 31, 2015 13:29
Operable Software

Operable Software

What does it mean to make software that doesn't just run, but is operable?

Good question! This represents some current thinking on the topic; there's tons of details in each of these things, so this list is expected to change and get more detailed over time.

Operable Software seems to involve (at a minimum) thinking a lot harder about and making sure there is a strategy (and code where appropriate) for:

  • Metrics
  • Logging
@ntalbott
ntalbott / total
Created October 14, 2013 04:53
A little script to take memory profiling output from rdbtool and do some key prefix totalling
#!/usr/bin/env ruby
hash = Hash.new{|h,k| h[k] = [0,0]}
aggregate_n = (ARGV[0] || 1).to_i
STDIN.each_line do |line|
parts = line.split(",")
key = parts[2][1..-2]
prefix = key.split(":")[0..(-1-aggregate_n)].join(":")
size = parts[3]
@ntalbott
ntalbott / example.rb
Created October 5, 2013 14:52
Thoughts on wrapping the Realex Vault API for ActiveMerchant
response = store(cc)
token = response.authorization #=> "#{payer_ref}:#{card_ref}"
update(token, {...})
@ntalbott
ntalbott / ksync
Created March 12, 2013 04:14
Syncs a directory structure to a non-touch Kindle and writes collections metadata.
#!/usr/bin/env ruby
require "rubygems"
require "pathname"
require "fileutils"
require "json"
require "digest/sha1"
require "awesome_print"
require 'potluck/recipes/smoke'
task :smoke_test do
failed_tests = []
curl_result = `curl -s -w "%{http_code}" https://id.spreedly.com/signin -o /dev/null`
failed_tests << "Id smoke test FAILURE." unless (curl_result == "200")
curl_result = `curl -s -w "%{http_code}" https://spreedly.com/ -o /dev/null`
failed_tests << "Public smoke test FAILURE." unless (curl_result == "200")
if ENV["STITCH"] == "1"
require "rack-proxy"
class Stitcher < Rack::Proxy
EXACT = %w(/ /terms /privacy)
PREFIX = %w(/pricing /about /support /gateways /assets)
def initialize(app)
@app = app
end
module Kernel
def backtrace
caller
end
end