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
<?php | |
function curlURL($url) { | |
$return = array(); | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_VERBOSE, 1); |
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
// https://github.com/jonathantneal/closest/blob/master/src/index.js | |
var ElementPrototype = window.Element.prototype; | |
if (typeof ElementPrototype.matches !== 'function') { | |
ElementPrototype.matches = ElementPrototype.msMatchesSelector || ElementPrototype.mozMatchesSelector || ElementPrototype.webkitMatchesSelector || function matches(selector) { | |
var element = this; | |
var elements = (element.document || element.ownerDocument).querySelectorAll(selector); | |
var index = 0; | |
while (elements[index] && elements[index] !== element) { | |
++index; | |
} |
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
// Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication | |
// http://creativecommons.org/publicdomain/zero/1.0/ | |
(function (win, doc) { | |
// Cut the mustard. | |
if (!win.localStorage) return; | |
// You should probably use a more specific selector than this. | |
var textarea = doc.querySelector('textarea'); | |
// The key for the key/value pair in localStorage is the current URL. | |
var key = win.location.href; |
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
// Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication | |
// http://creativecommons.org/publicdomain/zero/1.0/ | |
/* | |
This function takes two arguments: | |
element: a reference to a DOM node in the document e.g. a button. | |
feedbackContent: a string of text or HTML. | |
An example of usage would be: | |
document.querySelector('button').addEventListener('click', function() { |
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
// Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication | |
// http://creativecommons.org/publicdomain/zero/1.0/ | |
(function (win, doc) { | |
'use strict'; | |
// Cut the mustard | |
if (!doc.querySelectorAll || !doc.querySelectorAll('input[list]') || !win.HTMLDataListElement || !win.addEventListener){ | |
return; | |
} | |
// Loop through each input element with a list attribute |
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
<?php | |
function getEmbedCode($url="") { | |
$return = ''; | |
$providers = array( | |
'flickr.com' => 'https://www.flickr.com/services/oembed/', | |
'huffduffer.com' => 'https://huffduffer.com/oembed', | |
'instagram.com' => 'https://api.instagram.com/publicapi/oembed', |
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 (win, doc) { | |
win.addEventListener('load', function() { | |
var latlons = []; | |
doc.querySelectorAll('.h-geo').forEach( function(geo) { | |
var lat = geo.querySelector('data.p-latitude').getAttribute('value'); | |
var lon = geo.querySelector('data.p-longitude').getAttribute('value'); | |
if (lat && lon) { | |
latlons.push([lat, lon]); | |
} | |
}); |
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
// Generate a timestamp (in seconds) on the server. This won't change if the page is served from a cache. | |
var serverTimestamp = <?php echo time(); ?>; | |
// Create a new Date object from the local date and time on the client. | |
var localDate = new Date(); | |
// Convert the local date and time to Universal Time (same as the server). | |
var localUTCString = localDate.toUTCString(); | |
// Create a new Date object from the UTC date and time on the client. | |
var UTCDate = new Date(localUTCString); | |
// Generate a timestamp (in seconds) from the UTC date and time on the client. | |
var clientTimestamp = UTCDate.getTime() / 1000; |
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 (win, doc) { | |
win.addEventListener('beforeinstallprompt', function (e) { | |
e.preventDefault(); | |
var deferredPrompt = e; | |
var insertionPoint = doc.querySelector('main .contents'); | |
insertionPoint.insertAdjacentHTML('afterbegin',` | |
<div class="feedback" role="dialog" aria-labelledby="homescreen"> | |
<h2 id="homescreen">Install The Session</h2> | |
<p>Would you like to add The Session to your home screen?</p> | |
<button class="back">No, thanks</button> |