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
// Disable the payment/submit button until everything has loaded | |
// (if Stripe fails to load, we can't progress anyway) | |
$(document).ready(function() { | |
$("#payment-button").prop('disabled', false) | |
}) | |
var handler = StripeCheckout.configure("customButtonA", { | |
key: '<yourpublishablekey', | |
token: function(token, args){ | |
var $input = $('<input type=hidden name=stripeToken />').val(token.id); |
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
// use provides a cleaner interface for chaining middleware for single routes. | |
// Middleware functions are simple HTTP handlers (w http.ResponseWriter, r *http.Request) | |
// | |
// r.HandleFunc("/login", use(loginHandler, rateLimit, csrf)) | |
// r.HandleFunc("/form", use(formHandler, csrf)) | |
// r.HandleFunc("/about", aboutHandler) | |
func use(h http.HandlerFunc, middleware ...func(http.HandlerFunc) http.HandlerFunc) http.HandlerFunc { | |
for _, m := range middleware { | |
h = m(h) | |
} |
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
require 'bundler/setup' | |
require 'sinatra/base' | |
require 'rack/contrib' | |
# The project root directory | |
$root = ::File.dirname(__FILE__) | |
class SinatraStaticServer < Sinatra::Base | |
get(/.+/) do |
NewerOlder