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
# If /json route receives header "application/json" | |
@app.route("/json", methods=['GET','POST']) | |
def json(): | |
app.logger.debug("JSON received...") | |
app.logger.debug(request.json) | |
if request.json: | |
mydata = request.json # will be |
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
# put this in your app.py | |
@app.route("/nuts") | |
def nutbutter(): | |
# nuts and review | |
nuttbutterReviews = { | |
'almond' : 'great', | |
'peanut' : 'okay', | |
'walnut' : 'what is this stuff?' |
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 flickrapi | |
import urllib.request | |
import os.path | |
import json | |
# Make it work for Python 2+3 and with Unicode | |
import io | |
try: | |
to_unicode = unicode | |
except NameError: |
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 | |
// Example of how to log into Google API with ClientLogin, good to use when you're not making a webapp. | |
// code taken and minimally updated from http://kovshenin.com/2009/10/google-docs-api-client-login-with-php-and-curl-1494/ | |
// Construct an HTTP POST request | |
$clientlogin_url = "https://www.google.com/accounts/ClientLogin"; | |
$clientlogin_post = array( | |
"accountType" => "HOSTED_OR_GOOGLE", | |
"Email" => "your@gmail.com", |
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
// be sure to update manifest to allow external connections, | |
// https://developer.chrome.com/extensions/messaging#external-webpage | |
/* | |
"externally_connectable" : { | |
"matches": ["*://diyability-capacita.appspot.com/*"] | |
} | |
*/ | |
// Listen for incoming long lasting PORT connection from Webpage or extension |
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
<html ng-app="dragTest"> | |
<head> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script> | |
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js" type="text/javascript"></script> | |
<script src="http://code.angularjs.org/1.2.1/angular.min.js" type="text/javascript"></script> | |
<script src="http://code.angularjs.org/1.2.1/angular-sanitize.min.js"></script> | |
</head> | |
<body class="container"> | |
<div ng-controller="dragCtrlr"> |
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
/******************************/ | |
/* Bluegrass Event Bus PubSub */ | |
/* from https://davidwalsh.name/pubsub-javascript */ | |
/******************************/ | |
var BGEventBus = (function(){ | |
var topics = {}; | |
var hOP = topics.hasOwnProperty; | |
return { | |
subscribe: function(topic, listener) { |
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 os | |
from flask import Flask, request, render_template # Retrieve Flask, our framework | |
import requests | |
app = Flask(__name__) # create our flask app | |
# this is our main page | |
@app.route("/") | |
def index(): |
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
# this is our main page | |
@app.route("/", methods=['GET','POST']) | |
def index(): | |
# get Idea form from models.py | |
idea_form = models.IdeaForm(request.form) | |
# if form was submitted and it is valid... | |
if request.method == "POST" and idea_form.validate(): | |
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
var filename = 'my_data_pic.png'; | |
var photoData = req.body.photoData; | |
// convert to buffer | |
var photo_buffer = new Buffer(b64str, 'base64'); | |
// prepare database record | |
var photoPost = new Photo(); // create Blog object | |
// pick the Amazon S3 Bucket |