Skip to content

Instantly share code, notes, and snippets.

View Stanton's full-sized avatar
💃

Paul Stanton Stanton

💃
View GitHub Profile
@Stanton
Stanton / gist:73385d219ab27c1eee74
Created March 9, 2015 08:34
Add a class then remove it on animation or transition end
// Assume .foo triggers a CSS animation, or a transition and that we wish to
// remove the .foo class when the animation completes.
//
// Useful for declarative animation class names like .shake
// on animation end
var animationEnd = 'webkitAnimationEnd oanimationend oAnimationEnd msAnimationEnd animationend';
$('.foo')
.addClass('bar')

Given the following markup:

<fieldset id="comp-1">
    <legend id="comp-1[label]">Legend One</legend>    
    <label for="dd-1" id="dd-1[label]">Day</label>
    <input id="dd-1" type="text" />
</fieldset>

@Stanton
Stanton / white-space.css
Created April 23, 2012 08:30
CSS white-space - Cross browser
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* IE 5.5+ */
@Stanton
Stanton / Asset.css
Created November 2, 2012 14:36
LESS noise texture mixin
/**
* Adds a transparent noise texture as a background image to a given element.
* Texture strength can be controlled with @opacity parameter.
*/
.noise (@opacity: .3) {
&:before {
bottom: 0;
content: "";
left: 0;
opacity: @opacity;
@Stanton
Stanton / users_controller.php
Created July 20, 2012 14:01
HoM Users Controller
<?php
class UsersController extends AppController {
var $name = 'Users';
var $scaffold = 'admin';
var $components = array('JqImgcrop');
var $helpers = array('Javascript', 'Thumbnail', 'CropImage');
function beforeFilter() {
@Stanton
Stanton / Asset.js
Created June 11, 2012 08:29
Get document height
function getDocumentHeight() {
return Math.max(
Math.max(document.body.scrollHeight, document.documentElement.scrollHeight),
Math.max(document.body.offsetHeight, document.documentElement.offsetHeight),
Math.max(document.body.clientHeight, document.documentElement.clientHeight)
);
}
@Stanton
Stanton / html.html
Created May 29, 2012 10:48
dark on light inset text
text-shadow: 0px 1px 0px #e5e5ee;
@Stanton
Stanton / html.html
Created May 29, 2012 10:48
light on dark inset text
text-shadow: 0px -1px 0px #666;
<?php
$test = array('a', 'b', 'c');
function clean($input)
{
$output = $input . '!';
return $output;
}
@Stanton
Stanton / ie_inline-block.css
Created March 14, 2012 09:56
Inline block for IE6 & IE8
.element {
display: inline-block;
}
* + .element { // IE 6-7
display: inline;
}