Skip to content

Instantly share code, notes, and snippets.

@ianbarber
ianbarber / gist:f9db50ba8670a8d9119d
Created June 18, 2014 18:30
Retrieve code from GPPSignIn
- (void)finishedWithAuth:(GTMOAuth2Authentication *)auth error:(NSError *)error {
NSString *code = [GPPSignIn sharedInstance].homeServerAuthorizationCode;
// Send code to server!
}
@ianbarber
ianbarber / gist:ab41ae8f6d504bcd7ca3
Last active August 29, 2015 14:02
Sign in config with server side access for Google Sign In on iOS
// Configure sign in.
[GPPSignIn sharedInstance].homeServerClientId = @"123456-dfafdafdaf.googleusercontent.com";
[GPPSignIn sharedInstance].clientID = @"123456789-fr5f0j07iqodrel0ul2864ihcgs3pq.apps.googleusercontent.com";
[GPPSignIn sharedInstance].homeServerClientID = @"123456789-re29be622bntvec61dk5lsafq20rke.apps.googleusercontent.com";
[GPPSignIn sharedInstance].delegate = self;
@ianbarber
ianbarber / Session.php
Created May 20, 2014 21:54
Simple model wrapper for datastore class
<?php
namespace Tek;
use Symfony\Component\HttpFoundation\Request;
class Session {
public $sessionid;
public $url;
public $title;
@ianbarber
ianbarber / api.php
Created May 20, 2014 21:52
Silex based API for a tek-in example of PHP on AppEngine
<?php
require_once __DIR__.'/../../config.php';
require_once __DIR__.'/../vendor/autoload.php';
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Silex\Application;
session_start();
$app = new Application();
$client = buildClient();
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:light,regular,medium,thin,italic,mediumitalic,bold" title="roboto">
<title>Frowns</title>
<link rel="stylesheet" href="/template/basestyles.css">
<!-- // [START mystyle] -->
<style>
@ianbarber
ianbarber / RetrieveAccessTokenActivity.java
Created March 17, 2014 20:22
A quick example of retrieving an access token with GoogleAuthUtil
package com.google.devrel.samples.gmstest.app;
import android.app.Activity;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
<?php
// $client is authenticated with scopes "profile" and "email"
$service = new Google_Service_Plus($client);
$user = $service->people->get("me");
$name = $user->displayName;
$family_name = $user->name->familyName;
$given_name = $user->name->givenName;
$picture = $user->image->url;
// There can be > 1 email address, we want the main one
<?php
namespace Quiz;
use Symfony\Component\HttpFoundation\Request;
class Answer {
public $userid;
public $questionid;
public $country;
<?php
namespace Quiz;
use Symfony\Component\HttpFoundation\Request;
class Question {
public $questionid;
public $starttime;
public $questiontext;
new GoogleApiClient.Builder(this)
.addApi(Drive.API)
.addScope(Drive.SCOPE_FILE)
.addApi(Plus.API, plusOptions)
.addScope(Plus.SCOPE_PLUS_LOGIN)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();