Skip to content

Instantly share code, notes, and snippets.

View joshpalmeri's full-sized avatar
🎯
Focusing

joshpalmeri

🎯
Focusing
View GitHub Profile
@joshpalmeri
joshpalmeri / url-parameter-auto-play-on-page-load.js
Last active April 30, 2018 09:02
URL Parameter Auto Play on Page Load
/* From http://www.jquery4u.com/snippets/url-parameters-jquery/ */
/* Usage:
$('#city').val(decodeURIComponent($.urlParam('city')));
*/
$.urlParam = function(name){
var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
if (results==null){
return null;
}
else{
@joshpalmeri
joshpalmeri / url-replacements.js
Created March 29, 2017 13:53
Provides replacement functions on URLs
//strips protocol, domain and www. from a fully-qualified URL
function stripDomain(urlToStrip) {
return urlToStrip.replace(/.*?:\/\/(www\.)?/g, "");
}
//strips /index.php(/)?
function stripFileIndex(urlToStrip) {
return urlToStrip.replace(/(\/index(\.php)?)/g, "");
}
/* Send Confirmation Email with Google Forms */
function Initialize() {
var triggers = ScriptApp.getProjectTriggers();
for (var i in triggers) {
ScriptApp.deleteTrigger(triggers[i]);
}

A better way to do form labels

This pen was inspired by Brad's workshop presentation #bdconf in Nashville, TN, 10/23/13. We all know the problem. With only a placeholder label, once the user starts typing, he/she may not recall the label for that field. Oh what a dastardly thing! Well, here's a stab at using some JS to show a top-left aligned label when a value exists in the field.

A Pen by Josh Palmeri on CodePen.

License.

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>