Skip to content

Instantly share code, notes, and snippets.

View jamesmills's full-sized avatar

James Mills jamesmills

View GitHub Profile
<?php
if (!function_exists('applicationUrl')) {
/**
* Will return the fully qualified domain name for the correct environment etc
*
* @param string $sub_domain
* @param string $path
* @return string
<?php
namespace App\Http\Requests\Api;
use Illuminate\Http\JsonResponse;
use Illuminate\Contracts\Validation\Validator;
use Illuminate\Validation\ValidationException;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Foundation\Http\FormRequest as LaravelFormRequest;
THIS := $(realpath $(lastword $(MAKEFILE_LIST)))
HERE := $(shell dirname $(THIS))
.PHONY: fix lint test
fix:
$(HERE)/vendor/bin/php-cs-fixer fix --config=$(HERE)/.php_cs
lint:
$(HERE)/vendor/bin/php-cs-fixer fix --config=$(HERE)/.php_cs --dry-run
<?php
$finder = PhpCsFixer\Finder::create()
->in(__DIR__ . '/app')
->in(__DIR__ . '/database/migrations')
;
return PhpCsFixer\Config::create()
->setUsingCache(false)
->setRules([

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:

@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 / AdGroupCallExtension.php
Last active June 24, 2020 08:09
Google Adwords API. Creating a Call Extension for an AdGroup.
<?php
public function fire()
{
// See the Placeholder reference page for a list of all the placeholder types and fields.
// https://developers.google.com/adwords/api/docs/appendix/placeholders.html
define('PLACEHOLDER_SITELINKS', 1);
define('PLACEHOLDER_FIELD_SITELINK_LINK_TEXT', 1);
define('PLACEHOLDER_FIELD_SITELINK_URL', 2);
@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 / 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'), ));