Skip to content

Instantly share code, notes, and snippets.

@eriku
eriku / find_replace.php
Created Mar 28, 2016
Find a word wrapped in an asterisk (*) and wrap it in a span element
View find_replace.php
/**
* Search for an asterisk (*) in a string and wrap it with an element
*
* @example echo findAndWrap($module->get('title'), 'alternate-text')
*
* @package Erik's Functions
* @subpackage utility
*
* @param string $haystack | String to search
@eriku
eriku / sass-standards.md
Last active Aug 29, 2015
SASS Standards
View sass-standards.md

SCSS STYLEGUIDE

A mix of CSS-Tricks and CSS Guidelines

Extensions

  • Compass

Syntax and Formatting

  • Two (2) space indentation, not tabs
@eriku
eriku / require-featured-image.php
Last active Aug 29, 2015
Set Featured Image to required and add an asterix symbol to title in Wordpress
View require-featured-image.php
@eriku
eriku / meta-tags.php
Created Apr 17, 2015
Open Graph & Twitter Cards
View meta-tags.php
<?php
/**
* Open Graph & Twitter Card Meta Tags
*/
// Description
$description = false;
if ( is_single() || (is_page() && !is_front_page()) ) {
$description = $post->post_content;
$description = preg_replace('/\b(https?):\/\/[-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i', '', $description);
@eriku
eriku / date-range.php
Last active Aug 29, 2015
Output date range between 2 dates.
View date-range.php
<?php
function isValidTimestamp($timestamp) {
return ((string) (int) $timestamp === $timestamp)
&& ($timestamp <= PHP_INT_MAX)
&& ($timestamp >= ~PHP_INT_MAX);
}
function get_date_range($startDate, $endDate) {
$output = '';
$diff = false;
View SCSS-Breakpoint-Mixin.markdown