Skip to content

Instantly share code, notes, and snippets.

@eriku
eriku / find_replace.php
Created March 28, 2016 22:33
Find a word wrapped in an asterisk (*) and wrap it in a span element
/**
* 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 August 29, 2015 14:23
SASS Standards

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 August 29, 2015 14:22
Set Featured Image to required and add an asterix symbol to title in Wordpress
@eriku
eriku / meta-tags.php
Created April 17, 2015 17:09
Open Graph & Twitter Cards
<?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 August 29, 2015 14:18
Output date range between 2 dates.
<?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;
@eriku
eriku / SCSS-Breakpoint-Mixin.markdown
Created February 24, 2015 20:21
SCSS Breakpoint Mixin
@eriku
eriku / Complex-Button-Mixin-(Sass-Scss).markdown
Created February 24, 2015 20:20
Complex Button Mixin (Sass/Scss)