Skip to content

Instantly share code, notes, and snippets.

View jamesmills's full-sized avatar

James Mills jamesmills

View GitHub Profile
@jamesmills
jamesmills / .zsh_alias
Last active August 29, 2015 14:04
Alias
# Add 'source ~/.zsh_alias' to the bottom of ~/.zshrc to use
# Can also add to these to /Homestead/aliases for us with your Homestead VM
# Composer
alias csu="composer self-update"
alias cu="composer update"
alias ci="composer install"
alias cda="composer dump-autoload -o"
# Laravel / Artisan
@jamesmills
jamesmills / createCallAdGroupFeed.php
Last active August 29, 2015 14:04
This will associate a given FeedItem with an AdGroup.
<?php
protected function createCallAdGroupFeed(AdWordsUser $user, $feed, $feed_item, $adgroup)
{
// Get the CampaignFeedService, which loads the required classes.
$adGroupFeedService = $user->GetService('AdGroupFeedService');
$feedFunctionRequestContextOperand = new RequestContextOperand();
$feedFunctionRequestContextOperand->contextType = 'FEED_ITEM_ID';
@jamesmills
jamesmills / gist:3667389
Created September 7, 2012 15:57
Tesco API - Issue 1
There is an error with the response from the CHANGEBASKET function.
Sending
http://www.techfortesco.com/groceryapi/restservice.aspx?COMMAND=CHANGEBASKET&PRODUCTID=5556666777788888&CHANGEQUANTITY=1&SESSIONKEY={sessionKey}
Should not return
{ "StatusCode": 0, "StatusInfo": "Basket change completed successfully" }
@jamesmills
jamesmills / gist:3930151
Created October 22, 2012 07:38
geolocation
<script type="text/javascript" charset="utf-8">
<!--
function findLocation()
{
navigator.geolocation.getCurrentPosition(foundLocation, noLocation);
}
function foundLocation(position)
{
@jamesmills
jamesmills / index.php
Created December 18, 2012 13:04
Tour Offer Title
$content = new SimpleXMLElement(file_get_contents('http://www.traveleditions.co.uk/service.asmx/ReturnTours'));
foreach ($content->Tours->Tour as $tour) {
if ($tour->Country['Name'] == 'United Kingdom') {
echo '<p>' . htmlentities($tour->OfferTitle, ENT_QUOTES | ENT_IGNORE, "UTF-8") . '</p>';
}
}
@jamesmills
jamesmills / tour_booking_details.php
Last active December 11, 2015 05:48
Travel Editions Test
<?php
include('inc/functions.php');
$myTourOS = new TourOs();
// Get a new session from Tours API and store it in out own session to use it again
$_SESSION['tourOsToken'] = (string)$myTourOS->getSession();
output($_SESSION['tourOsToken'], 'tourOsToken');
// get the detials of the departure sending our own session and the ID sent in the URI
@jamesmills
jamesmills / gist:5748138
Created June 10, 2013 11:34
Get curl header
<?php
$ch = curl_init('http://cts-web-api.cloudapp.net/api/hotels?destination=mgm');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Range: items=1-5'));
$response = curl_exec($ch);
@jamesmills
jamesmills / gist:7638596
Last active December 29, 2015 07:49
Local Environment for Laravel

On Mac:

NOTE: Since updating my mac to OSX 10.9 (Mavericks) my local enviroment was not working. Turns out the hostname has changed.

Open Terminal and run hostname.

Open bootstrap/start.php and add $env = $app->detectEnvironment(array( 'local' => array('YOUR-HOSTNAME'), ));

Keybase proof

I hereby claim:

  • I am jamesmills on github.
  • I am jamesmills (https://keybase.io/jamesmills) on keybase.
  • I have a public key whose fingerprint is E216 5344 E65C D7D9 19C7 95D7 1244 7E3B A4D3 E51C

To claim this, I am signing this object: