This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
/** | |
* Creates a "slide" transition that will slide up/down the content within an element, no matter it's height. | |
* Some other solutions use max-height but that causes an annoying 'delay' due to having to use a large max-height | |
* value. | |
* | |
* This technique uses the element's "scrollHeight" and adjusts the elements height automatically. So you get a | |
* perfect slide effect w/o any delays. | |
* | |
* Usage: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
This is an example of how to easily manage a OneToMany relationship in a | |
Doctrine Entity with minimal code. | |
*/ | |
$req = new Req(); | |
$form = $this->createForm('AppBundle\Form\Type\MyType', $req); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Works like htmlentities() but only encodes entities as numeric codes | |
* instead of names (for use in XML). | |
*/ | |
function xmlentities($str, $encoding = 'UTF-8', $asList = false) | |
{ | |
$list = array(); | |
$ent = ''; | |
$chars = preg_split('//u', $str, -1, PREG_SPLIT_NO_EMPTY); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// $().closestStyle() | |
// find the closest CSS style of a parent for a DOM element and apply it | |
// to the selected element. I use this mainly before calling | |
// .effect('highlight') so the backgroundColor will mesh properly. | |
// @example: | |
// $('.row').closestStyle('backgroundColor').effect('highlight'); | |
(function($){ | |
$.fn.closestStyle = function(attr, val){ | |
var me = $(this); | |
me.parents().each(function(i){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add HTML5 'placeholder' support to selected inputs if not natively supported. | |
// @example: | |
// $(':text[placeholder]').placeholder(); | |
// @css: | |
// input.placeholder { color: #aaa; } /* since IE doesn't properly support :not() */ | |
// | |
(function($){ | |
if (document.createElement('input').placeholder !== undefined) { | |
$.fn.placeholder = $.noop; | |
} else { |