Skip to content

Instantly share code, notes, and snippets.

View panphora's full-sized avatar
🎯
Focusing

David Miranda panphora

🎯
Focusing
View GitHub Profile
window.addEventListener("keydown", (event) => {
if (event.keyCode === 32) {
event.preventDefault();
if (player.paused) player.play(); else player.pause();
}
});
@panphora
panphora / expand-podcast-to-see-episodes.js
Created September 14, 2017 21:11
Modifying overcast.fm to make it more like the app
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) {
@panphora
panphora / slow-down-twitch-chat.js
Created February 25, 2016 02:14
Slow down twitch chat
// INSTRUCTIONS
// 1. paste in Google Chrome dev console
// 2. enjoy!
// don't display any chat messages by default
var style = document.createElement("style");
style.appendChild(document.createTextNode(""));
document.head.appendChild(style);
style.sheet.insertRule("body .ember-chat .chat-messages .chat-line {display: none;}", 0);
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("@")) {
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;
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
@panphora
panphora / contact.php
Last active January 9, 2019 20:03 — forked from libryder/contact.php
Super simple PHP contact form in one file
<html>
<head>
<title>Contact Us</title>
</head>
<body>
<?php
if ($_POST['message']) {
$message = $_POST['message'];
/*
# Description
A light jQuery replacement that takes a selector and returns an instance with helper methods.
# API
## event delegation
// DESCRIPTION:
// ============
// loops through all items in a nested object/array
//
// USE:
// ===
// forEachNestedData({currentItem, callback});
//
// OUTPUT:
// ======
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();
}