Skip to content

Instantly share code, notes, and snippets.

View alstr's full-sized avatar

Alastair Mooney alstr

View GitHub Profile
@mindpalette
mindpalette / trim-excerpt-whitespace.php
Last active March 19, 2020 13:56
WordPress Filter - Trim Excerpt Whitespace
<?php
// trim excerpt whitespace
if ( !function_exists( 'mp_trim_excerpt_whitespace' ) ) {
function mp_trim_excerpt_whitespace( $excerpt ) {
return trim( $excerpt );
}
add_filter( 'get_the_excerpt', 'mp_trim_excerpt_whitespace', 1 );
}
@dustinfarris
dustinfarris / session_enabled_test_case.py
Last active April 18, 2024 22:17
Setting session variables whilst testing with Django's TestCase
"""
Attempting to set session variables directly from TestCases can
be error prone. Use this super-class to enable session modifications
from within your tests.
Usage
-----
class MyTest(SessionEnabledTestCase):