Skip to content

Instantly share code, notes, and snippets.

@atsea
atsea / add-to-homescreen-test.html
Created September 24, 2020 20:37 — forked from PaulKinlan/add-to-homescreen-test.html
iOS Add to Homescreen => simulate web app manifest
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Add to Homescreen</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-title" content="Test name 2">
@atsea
atsea / touch-detect.js
Created June 6, 2019 16:23
JS - Detect touch screen
// https://codepen.io/Ferie/pen/vQOMmO
function is_touch_device() {
var prefixes = ' -webkit- -moz- -o- -ms- '.split(' ');
var mq = function(query) {
return window.matchMedia(query).matches;
}
if (('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) {
return true;
@atsea
atsea / className-properties-translated.js
Last active April 17, 2018 17:40
jQuery to JS: removeClass, addClass, hasClass translated
// jQuery hasClass()
$('sel').hasClass('classname');
/**
* Translating className properties from jQuery to plain JS v1.0
* Created by Christopher Leonard (https://www.atseadesign.com)
* Copyright 2018 Christopher Leonard
* Licensed under GNU (https://opensource.org/licenses/GPL-3.0)
*
* Browser support: <https://caniuse.com/#search=classList>
@atsea
atsea / aria-accessible-keyboard-script.js
Last active November 2, 2017 01:15
ARIA accessibile keyboard script allows disabled users to navigate the page left, right, up or down.
/**
* SOCIAL SHARING TOOL BAR ARIA
* @type {[type]}
* @see https://dequeuniversity.com/library/aria/content-feedback/sf-social-toolbar
*/
var $toolbar = $('#social-toolbar');
var $items = $toolbar.find('li');
$toolbar.on('keydown', '.button', function (e) {
var which = e.which;
var target = e.target;
@atsea
atsea / wp_config_pantheon.php
Last active October 24, 2017 14:41
Pantheon wp_debug inside wp_config
<?php
// Original located at https://github.com/pantheon-systems/pantheon-settings-examples/blob/master/wordpress/wp-debug-expanded.wp-config.php
// ASD gist https://gist.github.com/atsea/f14478bd6bf8bf6c83f32a03986f4e7f
// All Pantheon Environments.
if (defined('PANTHEON_ENVIRONMENT')) {
//Wordpress debug settings in development environments.
if (!in_array(PANTHEON_ENVIRONMENT, array('test', 'live'))) {
// Debugging enabled.
if (!defined( 'WP_DEBUG' )) {
define( 'WP_DEBUG', true );
@atsea
atsea / jsond-script-loading.html
Created August 1, 2017 17:47
JS - Create script tag to load JSON-D data for SEO
// JSON-D SCRIPT LOADING
// @see https://www.html5rocks.com/en/tutorials/speed/script-loading/
<link rel="subresource" href="//www.timothysofnewark.com/blog/js/tims-jsond.js">
<script type="text/javascript">
document.documentElement.className = 'js';
var scripts = [
'tims-jsond.js'
@atsea
atsea / localstorage-json-set-get-item.html
Created July 28, 2017 14:15
Pass field text value to another page using localstorage.
/**
* PASS TITLE TO ANOTHER PAGE
*
* Saves title text from form via localStorage to display on success page.
* @type {Object}
*/
var m={title:$('.udel--title h1').text()};
localStorage.setItem('udel_frm_title', JSON.stringify(m));
//GET
@atsea
atsea / jquery-get-join-checkbox-group-values.html
Created July 28, 2017 14:03
jQuery use .get().join() methods to group checkbox values together in email receipt.
/**
* CHECKBOX GROUP
*
* Uses .get().join() methods to group values together in email receipt.
* @return array
*/
function Populate(){
var cbArray = [];
vals = $('#cb_type_id input[type="checkbox"]:checked').map(function() {
return this.value;
@atsea
atsea / jquery-change-footprints-type.html
Created July 19, 2017 17:16
Change FootPrints Type and subtype
$(function() {
$('select[name=problem]').on('change',function() {
switch (true) {
case $(this).val() == 'Other':
$('input:hidden[name=type]').val('Research');
break;
case $(this).val() == 'Programming Assistance':
$('input:hidden[name=type]').val('Research');
$('input:hidden[name=subtype]').val('Programming Assistance');
@atsea
atsea / index.html
Last active June 6, 2017 13:14
jQuery: toggle div
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://github.com/jgthms/bulma/blob/master/css/bulma.css" type="text/css" media="screen">
</head>
<body>
<section class="section">
<div class="container">
<form method="post" action="" id="ud_fdp_form" name="ud_fdp_form">
<div class="field">