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
from flask import Flask | |
app = Flask(__name__) | |
@app.route("/") | |
def hello(): | |
return "Hello World!" | |
if __name__ == "__main__": | |
app.run() |
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
from flask import render_template, Flask | |
app = Flask(__name__) | |
@app.route('/hello') | |
def hello(): | |
return render_template('hello.html') | |
if __name__ == "__main__": | |
app.run() |
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
from flask import request, Flask, session | |
app = Flask(__name__) | |
@app.route("log_in", methods=["POST"]) | |
def log_in(): | |
if request.form["uname"] == "admin" and request.form["pass"] == "password": | |
session["logged_in"] = True |
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
public int addNumbers(int x, int y) { | |
int result = x+y; | |
Database.write(result); | |
return result; | |
} |
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
gem install resque |
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
gem install stripe |
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
<div class=".payment-errors"></div> | |
<form action="REPLACE WITH AN ACTUAL URL HELPER" method="post" id="stripe-form"> | |
<div class="formset"> | |
<label>Card Number</label> | |
<input type="text" size="20" autocomplete="off" class="credit-number" /> | |
</div> | |
<div class="formset"> | |
<label>Security Code/CVC</label> |
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
<script type="text/javascript" src="https://js.stripe.com/v1/"></script> |
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
Stripe.setPublishableKey('PUBLISHABLE KEY'); |
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
function stripeResponseHandler(status, response) { | |
if (response.error) { | |
$(".payment-errors").text(response.error.message); | |
} | |
else { | |
var form$ = $("#stripe-form"); | |
var token = response['id']; | |
form$.append("<input type='hidden' name='stripeToken' value='" + token + "'/>"); | |
form$.get(0).submit(); |
OlderNewer