Skip to content

Instantly share code, notes, and snippets.

Tommy Marshall tommymarshall

Block or report user

Report or block tommymarshall

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
tommymarshall / Handler.php
Created Jan 5, 2017
app/Exceptions/Handler.php contents
View Handler.php
namespace App\Exceptions;
use Exception;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler
tommymarshall / MetaViewServiceProvider.php
Created Jun 2, 2016
Feed meta data values into a view only once based on a route (right now, every time a view is called it gets overwritten) ie. Want to reference in my layouts.base {{ meta.title }}.
View MetaViewServiceProvider.php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class MetaViewServiceProvider extends ServiceProvider
public function boot()
tommymarshall / cleanup.php
Created May 25, 2016
Resets WordPress posts to a previous revision that does not contain spam links.
View cleanup.php
function contains($str, array $arr)
foreach($arr as $a)
if (stripos($str, $a) !== false) return true;
return false;
View CookieTest.php
protected function assertCookie($key, $value)
$headers = new Collection($this->response->headers->allPreserveCase());
$cookies = new Collection($headers->get('Set-Cookie', []));
$matches = $cookies->filter(function($raw_cookie) use ($key, $value) {
list($raw_value) = explode('; ', $raw_cookie);
list($set_name, $set_value) = explode('=', $raw_value);
tommymarshall /
Last active Apr 21, 2016
Move WordPress Generated Files to ./thumbnails/ folder

Move WordPress Generated Files to ./thumbnails/ folder

Keeping WordPress Media Library updated even after a server move.


  1. Place the move.php script inside of a folder containing images containing both the Original and WordPress auto-generated thumbnails.
  2. Run the script by navigating to it in the browser. All WordPress generated images will be moved to the ./thumbnails/ subfolder, all remaining images in your original folder are original images.
  3. Upload all Original images to your server.
  4. Install Add From Server Plugin to WordPress.
  5. Select all original images within the Add From Server interface and import.
View template-search-integrated.php
Template Name: Search
global $paged;
// Search WP stuff
global $post;
$query = isset($_REQUEST['q']) ? sanitize_text_field($_REQUEST['q']) : '';
tommymarshall / Feed.php
Created Apr 5, 2016
create new instance from class names
View Feed.php
class Feed {
public function items()
return $this->feedItems()->map(function($element) {
return $this->createInstance($element['content_type'], $element);
tommymarshall /
Last active Mar 24, 2016
Launching a WordPress site

Bringing a Bedrock WordPress site live


1. Backup Database

Obligatory reminder to plan for the unexpected and give ourselves that peace of mind knowing we can restore what we messed up.

2. Deploy most up-to-date version

From your project repository, ensure that what is on production is up-to-date.

View response.txt
[2016-03-15 17:21:49] lumen.INFO: Updating: General Manager Housing(862) ||| object(stdClass)#648 (55) {
string(20) "2004-12-22T16:03:10Z"
string(20) "2016-03-09T16:39:04Z"
array(1) {
tommymarshall / lumen.log
Last active Mar 15, 2016
Weird "ÿÿÿÿ" Issue
View lumen.log
[2016-03-15 14:02:41] lumen.ERROR: Symfony\Component\Debug\Exception\FatalErrorException: Uncaught Error: Class 'Symfony\Component\Debug\ExceptionHandlerÿÿÿÿ' not found in /home/vagrant/Projects/Atlantic/fluxx/vendor/laravel/lumen-framework/src/Exceptions/Handler.php:89
Stack trace:
#0 /home/vagrant/Projects/Atlantic/fluxx/app/Exceptions/Handler.php(48): Laravel\Lumen\Exceptions\Handler->render(Object(Illuminate\Http\Request), Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#1 /home/vagrant/Projects/Atlantic/fluxx/vendor/laravel/lumen-framework/src/Concerns/RegistersExceptionHandlers.php(128): App\Exceptions\Handler->render(Object(Illuminate\Http\Request), Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#2 /home/vagrant/Projects/Atlantic/fluxx/vendor/laravel/lumen-framework/src/Concerns/RegistersExceptionHandlers.php(51): Laravel\Lumen\Application->handleUncaughtException(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#3 [internal function]: Laravel\Lumen\Applicat
You can’t perform that action at this time.