Skip to content

Instantly share code, notes, and snippets.

View miguelbalparda's full-sized avatar
🏠
Working from home

Miguel Balparda miguelbalparda

🏠
Working from home
View GitHub Profile
@miguelbalparda
miguelbalparda / gist:8221903
Last active January 2, 2016 00:09
Change store by location - Magento
$ip = $_SERVER["REMOTE_ADDR"];//cant use helper, not loaded yet
$location = file_get_contents('http://api.ipinfodb.com/v3/ip-city/?key=<api_key>&format=json&ip='.$ip.'');
$location = json_decode($location);
$country = $location->countryCode;
if(strcmp($country,'CA') == 0) {
$mageRunType = 'store';
$mageRunCode = 'en_ca';
@miguelbalparda
miguelbalparda / gist:6426127
Created September 3, 2013 16:23
Google+ Auth for Google apps
<?php
require_once 'google-api-php-client/src/Google_Client.php';
require_once 'google-api-php-client/src/contrib/Google_PlusService.php';
require_once 'google-api-php-client/src/contrib/Google_Oauth2Service.php';
// Set your cached access token. Remember to replace $_SESSION with a
// real database or memcached.
session_start();
$client = new Google_Client();