Skip to content

Instantly share code, notes, and snippets.

@MeLight
MeLight / oauth2client v3.0.0 domain delegation (python).py
Last active August 11, 2016 08:13
Using the updated oauth2client library to get delegated domain access by the means of ServiceAccountCredentials
from oauth2client.service_account import ServiceAccountCredentials
import httplib2
from googleapiclient import discovery
import oauth2client
def main():
"""Shows basic usage of the Google Admin SDK Directory API.
Creates a Google Admin SDK API service object and outputs a list of first
10 users in the domain.
"""
//-------- Client side
var my_array = ['a', 'b', 'c'];
$.get('/api/end_point', {arr: JSON.stringify(my_array)}, function(data) { //note that we stringify the array before sending it
//we assume everything went well on the server
}, 'json');
#--------- Server side
class ArrayRequestHandler(webapp2.RequestHandler):
[
{
"ingredients":["sugar", "water"],
"time": 300,
"description": "Boil water, mix with sugar"
},
{
"ingredients":["eggs"],
"time": 0,
"description": "Break eggs, mix in mixer"
from google.appengine.ext import ndb
from datetime import date
class DateTest(ndb.Model):
date = ndb.DateProperty()
d = date(2015, 10, 20)
dt = DateTest()
//-------- Client side
var my_array = ['a', 'b', 'c'];
$.get('/api/end_point', {arr: JSON.stringify(my_array)}, function(data) { //note that we stringify the array before sending it
//we assume everything went well on the server
}, 'json');
#--------- Server side
import json
application: woven-environs-93111
version: dev
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /favicon.ico
static_files: favicon.ico
upload: favicon.ico
hello world this, and that
@MeLight
MeLight / gist:3315278
Created August 10, 2012 16:09
Why don't I get notifications on the client?
//Client
Meteor.autosubscribe(function() {
console.log("Subbed to request");
Meteor.subscribe("requests", Session.get('player_id'), function(){
var call = Requests.findOne();
console.log("in request (call: " +call+")");
Meteor.call("answerCall", call._id);
});
});