Skip to content

Instantly share code, notes, and snippets.

share = [[GooglePlusShare alloc] initWithClientID:clientId];
share.delegate = self;
@synthesize share;
....
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
// Handle Google+ share dialog URL.
if ([share handleURL:url
sourceApplication:sourceApplication
@interface AppDelegate : UIResponder <UIApplicationDelegate>
{
GooglePlusShare *share;
}
@property (strong, nonatomic) UIWindow *window;
@property (retain, nonatomic) GooglePlusShare *share;
- (void)viewDidLoad
{
[super viewDidLoad];
NSString *clientId = [AppDelegate clientId];
share = [[GooglePlusShare alloc] initWithClientID:clientId];
share.delegate = self;
AppDelegate *appDelegate = (AppDelegate *)
[[UIApplication sharedApplication] delegate];
appDelegate.share = share;
<?php
$client = new Google_Client();
$client->setApplicationName("Oyster+");
$client->setClientId('YOUR_CLIENT_ID_HERE');
$client->setClientSecret('YOUR_CLIENT_SECRET_HERE');
$client->setRedirectUri('http://localhost:8080/oyster');
$client->setDeveloperKey('YOUR_DEVELOPER_KEY');
$client->setScopes(array('https://www.googleapis.com/auth/plus.me', 'https://www.googleapis.com/auth/plus.moments.write'));
<?php
if (isset($_GET['code'])) {
$client->authenticate();
$_SESSION['access_token'] = $client->getAccessToken();
}
<?php
function write_moments_from_file($file, $client) {
$plus = new Google_PlusService($client);
$history = new Google_PlusMomentsService($client);
$log = array();
$fh = fopen($file, 'r');
while(($record = fgetcsv($fh)) && $record !== false) {
// Skip the header row
<?php
function write_moments_from_file($file, $client) {
$plus = new Google_PlusService($client);
$history = new Google_PlusMomentsService($client);
$log = array();
$fh = fopen($file, 'r');
<?php
while(($record = fgetcsv($fh)) && $record !== false) {
// Skip the header row
if($record[0] === "Date") {
continue;
}
// Create the moment and target
$moment = new Google_Moment();
$moment->setType("http://schemas.google.com/CheckInActivity");
<?php
// Extract fields from the record
list($date, $start, $end, $journey, $rest) = $record;
// Extract dates
$startdt = strtotime($date . " " . $start);
$enddt = strtotime($date . " " . $end);
// If we cross over midnight
if($enddt < $startdt) {
$enddt = strtotime("+1 day", $enddt);