This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function slugify (str) { | |
return str | |
.trim() | |
.replace(/[^0-9A-Za-z\-\s]/g, " ") // keep alphanumeric, dashes, and spaces | |
.replace(/ +/g, " ") // replace double spaces with single space | |
.replace(/ /g, "-") // replace single spaces with single dash | |
.replace(/\-\-/g, "-") // replace double dashes with single dash | |
.toLowerCase(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// DESCRIPTION: | |
// ============ | |
// loops through all items in a nested object/array | |
// | |
// USE: | |
// === | |
// forEachNestedData({currentItem, callback}); | |
// | |
// OUTPUT: | |
// ====== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
# Description | |
A light jQuery replacement that takes a selector and returns an instance with helper methods. | |
# API | |
## event delegation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Contact Us</title> | |
</head> | |
<body> | |
<?php | |
if ($_POST['message']) { | |
$message = $_POST['message']; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function displayTimeLeft (endDate) { | |
var msUntilDate = endDate - (new Date).getTime(); | |
var secs = Math.floor(msUntilDate / 1000) // total seconds until end date | |
, mins = Math.floor(secs / 60) // total minutes until end date | |
, hours = Math.floor(mins / 60) // total hours until end date | |
, days = Math.floor(hours / 24); // total days until end date | |
secs = secs % 60; // seconds remaining after dividing by 60 -- for display in countdown | |
mins = mins % 60; // minutes remaining after dividing by 60 -- for display in countdown |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getScript(source, callback) { | |
var scriptElement = document.createElement('script'); | |
var priorScriptElement = document.getElementsByTagName('script')[0]; | |
scriptElement.async = 1; | |
scriptElement.onload = scriptElement.onreadystatechange = function( _, isAbort ) { | |
if (isAbort || !scriptElement.readyState || /loaded|complete/.test(scriptElement.readyState) ) { | |
scriptElement.onload = scriptElement.onreadystatechange = null; | |
scriptElement = undefined; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var $activeEpisodes = $(".episodecell"); | |
var episodesReversedElements = $activeEpisodes.toArray().reverse(); | |
var lastPodcastName; | |
episodesReversedElements.forEach(function (elem) { | |
var $activeEpisode = $(elem); | |
var podcastName = $activeEpisode.find(".titlestack div:first-child").text(); | |
var podcastImgSrc = $activeEpisode.find(".art").attr("src"); | |
if (podcastName !== lastPodcastName) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mailgun = require('mailgun-js')({apiKey: api_key, domain: domain}); | |
const twilio = new require('twilio')(accountSid, authToken); | |
export default function notify (to, msg, options) { | |
if (Array.isArray(to)) { | |
to.forEach((toSingle) => notify(toSingle, msg, options)); | |
return; | |
} | |
if (to.includes("@")) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var $activeEpisodes = $(".episodecell"); | |
var episodesReversedElements = $activeEpisodes.toArray().reverse(); | |
var lastPodcastName; | |
episodesReversedElements.forEach(function (elem) { | |
var $activeEpisode = $(elem); | |
var podcastName = $activeEpisode.find(".titlestack div:first-child").text(); | |
var podcastImgSrc = $activeEpisode.find(".art").attr("src"); | |
if (podcastName !== lastPodcastName) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.addEventListener("keydown", (event) => { | |
if (event.keyCode === 32) { | |
event.preventDefault(); | |
if (player.paused) player.play(); else player.pause(); | |
} | |
}); |