Skip to content

Instantly share code, notes, and snippets.

@mikem33
mikem33 / vendor-codes.php
Created June 27, 2019 11:56
Vendor Pixel Codes
<?php /* Add Google Tag Manager javascript code as close to
the opening <head> tag as possible
=====================================================*/
function add_gtm_head() {
?>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
@mikem33
mikem33 / mixins.scss
Created March 12, 2019 08:06
Media Queries Sass Mixins
// $Media $Queries
@mixin above($value, $width: true) {
@if $width {
@media (min-width: em($value)) {
@content;
}
} @else {
@media (min-height: em($value)) {
@content;
}
@mikem33
mikem33 / slugify.php
Created February 28, 2019 17:57
Slugify PHP Function
function slugify($str) {
// Convert to lowercase and remove whitespace
$str = strtolower(trim($str));
// Replace high ascii characters
$chars = array("ä", "ö", "ü", "ß");
$replacements = array("ae", "oe", "ue", "ss");
$str = str_replace($chars, $replacements, $str);
$pattern = array("/(é|è|ë|ê)/", "/(ó|ò|ö|ô)/", "/(ú|ù|ü|û)/");
$replacements = array("e", "o", "u");