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 / spreedly-core-api.txt
Created September 3, 2012 02:31 — forked from calvincorreli/spreedly-core-api.txt
Overview of Spreedly Core API endpoints
OPTIONS https://spreedlycore.com/v1/gateways.xml => list supported gateways
POST https://spreedlycore.com/v1/gateways.xml => add a gateway
GET https://spreedlycore.com/v1/gateways.xml => list all added gateways
PUT https://spreedlycore.com/v1/gateways/token.xml => Update gateway
PUT https://spreedlycore.com/v1/gateways/token/redact.xml => Remove sensitive gateway data
POST https://spreedlycore.com/v1/gateways/token/purchase.xml => purchase - supply a payment method token also
POST https://spreedlycore.com/v1/gateways/token/authorize.xml => authorize - supply a payment method token also
POST https://spreedlycore.com/v1/payment_methods => Capture credit card from form - transparent redirect magic
GET https://spreedlycore.com/v1/payment_methods.xml => list all retained credit cards
@ntalbott
ntalbott / .gitignore
Created February 15, 2012 21:30
campfire transcript export
exports
@ntalbott
ntalbott / curl_put_spreedly.php
Created June 20, 2011 12:28 — forked from gjsoulman/curl_put_spreedly.php
PHP CURL PUT to Spreedly Core
<?php
$apiLogin = 'Ll6fAtoVSTyVMlJEmtpoJV8Shw5';
$apiSecret = 'RKOCG5D8D3fZxDSg504D0IxU2XD4Io5VXmyzdCtTivHFTTSylzM2ZzTWFwVH4ucG';
$paymentToken = 'N2V9GWfTgYv4jXAz2vcc4T3i8f6';
$url = 'https://spreedlycore.com/v1/payment_methods/' . $paymentToken . '/retain.xml';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_USERPWD, $apiLogin . ':' . $apiSecret);
#!/usr/bin/env ruby
command = '/usr/bin/passenger-memory-stats'
memory_limit = 200 # megabytes
def running?(pid)
begin
return Process.getpgid(pid) != -1
rescue Errno::ESRCH
return false
# Copyright 2009 Michael Ivey, released to public domain
# Disqus guts lifted from http://github.com/squeejee/disqus-sinatra-importer/tree/master
# I wanted it to run from MySQL and command line, instead of a Sinatra app
require 'rubygems'
require 'feed_tools'
require 'rest_client'
require 'json'
require 'sequel'
@ntalbott
ntalbott / gist:36841
Created December 16, 2008 22:11 — forked from mikehale/gist:36462
def parse_headers
request = "GET /remote/path/img.gif HTTP/1.1\r\nAccept-Language: en-us,en;q=0.5\r\nCache-Control: max-age=0\r\nIf-None-Match: \"58dc30c-216-3d878fe2\"-gzip\r\nX-Forwarded-For: 127.0.0.1\r\nAccept: image/png,image/*;q=0.8,*/*;q=0.5\r\nConnection: Keep-Alive\r\nX-Forwarded-Server: www.example.com\r\nAccept-Encoding: gzip,deflate\r\nUser-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4\r\nCookie: cookie1=YWJj; cookie2=ZGVm\r\nReferer: http://www.example.com/posts/\r\nAccept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\nHost: localhost:4001\r\nX-Forwarded-Host: www.example.com\r\nIf-Modified-Since: Tue, 17 Sep 2002 20:26:10 GMT\r\n\r\n"
request.split("\r\n")[1..-1].inject({}) do |h,e|
k,v = e.split(': ') # Concern - could this ever split in to 3 or more elements?
h[k] = v
h
}
end