Skip to content

Instantly share code, notes, and snippets.

View treetop1500's full-sized avatar

Robert Wade treetop1500

  • Gray Loon Marketing Group
  • Salt Lake City, Utah
View GitHub Profile
@treetop1500
treetop1500 / config_prod.yml
Last active October 7, 2016 12:13
Monolog Config
monolog:
handlers:
main:
type: rotating_file
path: %kernel.logs_dir%/%kernel.environment%.log
level: error
max_files: 10
action_level: error
bubble: true
slack:
@treetop1500
treetop1500 / symfony_accessible_breadcrumbs
Last active November 8, 2016 18:04
Accessible Symfony Breadcrumbs
// app/resources/views/breadcrumbs.html.twig
// this file will be included with the 'breadcrumbs' variable
<nav aria-label="You are here:" role="navigation">
<ul class="breadcrumbs">
<li>
<a href="/">
<i class="fa fa-home"></i>
</a>
</li>
{% for crumb in breadcrumbs %}
@treetop1500
treetop1500 / index.html.twig
Created March 15, 2017 14:44
Copy to clipboard with javascript and Foundation input groups and tooltips
{# 1: Setup --------------------------------- #}
{# https://clipboardjs.com/ #}
{# 2: Input group -------------------------- #}
<div class="input-group">
<label for="vcsRepo" class="input-group-label">{{ entity.vcsSystem }}:</label>
<input type="text" class="input-group-field" id="vcsRepo" name="vcsRepo" value="{{ entity.vcsRepo }}" />
<div class="input-group-button">
<button id="copyRepo"
data-clipboard-target="#vcsRepo"
@treetop1500
treetop1500 / MarkDownTransformer.php
Created March 24, 2017 17:20
DataTransformer for Markdown Syntax and custom Markdown input field
<?php
namespace Common\ContentBundle\DataTransformer;
use Symfony\Component\Form\DataTransformerInterface;
/**
* Class MarkdownTransformer
* @package Common\ContentBundle\DataTransformer
*/
class MarkdownTransformer implements DataTransformerInterface
@treetop1500
treetop1500 / RsyncCommand.php
Last active April 26, 2017 16:33
Rsync Console Command
<?php
/**
* Created by rwade@grayloon.com
* User: rwade
* Date: 4/26/17
* Time: 9:53 AM
* @todo update output to be buffered realtime output
* @todo colored output
*/
namespace AppBundle\Command;
@treetop1500
treetop1500 / AmazonS3Service.php
Last active October 3, 2017 15:39
A class for communicating uploads via the Amazon AWS PHP SDK
<?php
namespace Hoyt\UtilBundle;
use Aws\S3\S3Client;
/**
* Class AmazonS3Service
*
* @package Hoyt\UtilBundle
*/
@treetop1500
treetop1500 / FroalaS3Service
Last active October 3, 2017 16:15
A helper service for uploading to S3 via Froala
<?php
/**
* Created by PhpStorm.
* User: rwade@grayloon.com
* Date: 10/2/17
* Time: 12:18 PM
*/
namespace Hoyt\UtilBundle;
@treetop1500
treetop1500 / 1. composer.json
Created March 21, 2018 18:34
Doctrine Fetch Any Number of Random Results
{
...
"require": {
"luxifer/doctrine-functions": "~1.4",
}
}
@treetop1500
treetop1500 / pre-commit
Created September 4, 2018 16:10
Git pre-commit hook for running phpunit functional and unit tests.
#!/usr/local/bin/php
<?php
echo "Running tests.. ";
exec('bin/phpunit', $output, $returnCode);
if ($returnCode !== 0) {
// Show full output
echo PHP_EOL . implode($output, PHP_EOL) . PHP_EOL;
echo "Aborting commit.." . PHP_EOL;
exit(1);
@treetop1500
treetop1500 / AdminDashboardController.php
Created September 18, 2018 16:16
Easy Admin Controller Extension with Google Analytics Dashboard
<?php
namespace App\Controller;
use Symfony\Component\HttpFoundation\Request;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AdminController;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Google_Client;
use Google_Service_AnalyticsReporting;
class AdminDashboardController extends AdminController