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 / 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 / FlatpickerDateTimeType.php
Last active September 10, 2022 08:52
Symfony3 Form Extension for use with Flatpickr javascript date/time pickers
<?php
namespace MyBundle\Form\Extension;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
/**
* Class FlatpickrDateTimeType
* @package MyBundle\Form\Extension
@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 / config_dev.yml
Last active October 3, 2016 15:50
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
grouped:
@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 / flash_msg.txt
Last active September 30, 2016 15:21
Flash Message
// controller delete action:
use Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException;
...
try {
$em->remove($entity);
$em->flush();
} catch(ForeignKeyConstraintViolationException $e) {
$this->addFlash('warning', 'This item is in use by related entities and cannot be deleted.');
}
@treetop1500
treetop1500 / FroalaController.php
Last active September 26, 2016 13:15
Froala Image Receiver Controller
<?php
/**
* Created by PhpStorm.
* User: grayloon
* Date: 9/3/16
* Time: 7:39 AM
*
* Set these routes up!!
* # froala receive route for file uploads
* froala_receiver:
@treetop1500
treetop1500 / SassMeister-input.scss
Last active September 22, 2016 19:10
Looping sass and incrementing by 3
// ----
// Sass (v3.4.21)
// Compass (v1.0.3)
// ----
.box {
@for $i from 0 through 9 {
$c : $i + 1;
&:nth-child(#{$c}) {
order: (($i - $i % 3) / 3) + 1;
@treetop1500
treetop1500 / sass-alpha-color-loop.scss
Last active September 22, 2016 15:49
For generating classes with alpha using rgb
@mixin alphaColor ($name,$color) {
@for $i from 1 through 10 {
.c-#{$name}-#{$i} {
color: rgba($color,$i/10);
}
}
}
@include alphaColor("blue",blue);
@include alphaColor("red",#ed1414);
@treetop1500
treetop1500 / twig_extension_price.php
Created September 16, 2016 16:22
Twig Extensions:twig_extension_price.php
/**
* @param $amt
* @return string
* strips out non-numeric characters and adds the +1 country code.
*/
function price($amt)
{
return '<span class="dollar-sign">$</span>'.number_format($amt,2);
}