This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |