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
// The JSON Schema that we place into the Initial Script | |
// section of the Runscope API test. | |
var rosterResponse = { | |
"definitions": { | |
"player": { | |
"id": "player", | |
"type": "object", | |
"required": ["player_number","guid","name"], | |
"properties": { | |
"player_number": { "type": "integer" }, |
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 keen.client import KeenClient | |
keen = KeenClient( | |
project_id="123", | |
write_key="abc" | |
) | |
@app.before_request | |
def before_request(): | |
if "/static/" in request.path: | |
return |
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
### Keybase proof | |
I hereby claim: | |
* I am johnsheehan on github. | |
* I am johnsheehan (https://keybase.io/johnsheehan) on keybase. | |
* I have a public key whose fingerprint is 701C 7D09 54E6 82F3 8007 479A C03D CEDB A3CC 6812 | |
To claim this, I am signing this object: |
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
import sys | |
import bitly_api | |
import os | |
from config import config | |
# sign up for a free account at runscope.com and make | |
# note of your bucket key | |
# connect to bitly | |
conn_btly = bitly_api.Connection(access_token=config['ACCESS_TOKEN']) |
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
import sys | |
import bitly_api | |
import os | |
from config import config | |
# sign up for a free account at runscope.com and make | |
# note of your bucket key | |
# connect to bitly | |
conn_btly = bitly_api.Connection(access_token=config['ACCESS_TOKEN']) |
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 static partial class RestClientExtensions | |
{ | |
public static RestResponse<dynamic> ExecuteDynamic(this IRestClient client, IRestRequest request) | |
{ | |
var response = client.Execute(request); | |
var generic = (RestResponse<dynamic>)response; | |
dynamic content = SimpleJson.DeserializeObject(response.Content); | |
generic.Data = content; |
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
@app.route('/xyzzy/ajax/<resource>', methods=['POST', 'GET', 'DELETE']) | |
@auth.required | |
@https_required | |
def admin_ajax(resource): | |
cmd = Command(request.method, resource) | |
# could replace this with data = request.params | |
data = request.args | |
if (request.method in ['PUT', 'POST']): | |
data = request.form |
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
class Command: | |
m = '' | |
r = '' | |
resources = { | |
'promo-codes' : { | |
'POST' : post_promo_code, | |
'DELETE' : delete_promo_code | |
}, | |
'approved-jobs' : { |
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
TWITTER_CONSUMER_KEY = '...' | |
TWITTER_CONSUMER_SECRET = '...' | |
TWITTER_ACCESS_TOKEN = '...' | |
TWITTER_TOKEN_SECRET = '...' | |
SENDGRID_USER = '...' | |
SENDGRID_KEY = '...' | |
STRIPE_SECRET_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
from functools import wraps | |
from flask import request, redirect | |
import os | |
def https_required(f): | |
@wraps(f) | |
def decorated_function(*args, **kwargs): | |
scheme = 'http' | |
if request.headers.get('x-forwarded-proto', None): | |
scheme = request.headers.get('x-forwarded-proto') |
NewerOlder