Skip to content

Instantly share code, notes, and snippets.

View gMagicScott's full-sized avatar

Scott Lesovic gMagicScott

View GitHub Profile
@gMagicScott
gMagicScott / AS Table Highlight
Created September 16, 2012 01:15
jQuery to highlight (add css class) table row for form fields on focus
$(document).ready(function () {
$("input,select,textarea").focus(function() {
$(this).closest("tr").addClass("curFocus")
});
$("input,select,textarea").blur(function() {
$(this).closest("tr").removeClass("curFocus")
});
});
@gMagicScott
gMagicScott / gist:3734672
Created September 16, 2012 22:42
Trigger change event for AS-Birthday
if(CheckPlural(this.value)===1){this.form.field11.selectedIndex=3;$('#field11').change()}
@gMagicScott
gMagicScott / gist:3735034
Created September 17, 2012 00:59
Combined AS-Birthday frontpage test
/*jslint browser:true */
/*global $*/
(function () {
"use strict";
var multiAR, genderField, tomorrowField, childNameField, defaultAR, getGender, changeAR, titleCaseHandler, pluralHandler;
//******************************
// Settings
//******************************
multiAR = 'XXXXXX'; //Multi-Child Autoresponder ID Number
tomorrowField = '#field7'; //Field that holds tomorrow's date
@gMagicScott
gMagicScott / gist:3801735
Created September 28, 2012 19:41
calculate distance between two lat&lng points
function distance($lat1, $lng1, $lat2, $lng2, $miles = true) {
$pi80 = M_PI / 180;
$lat1 *= $pi80;
$lng1 *= $pi80;
$lat2 *= $pi80;
$lng2 *= $pi80;
$r = 6372.797; // mean radius of Earth in km
$dlat = $lat2 - $lat1;
$dlng = $lng2 - $lng1;
@gMagicScott
gMagicScott / gist:4367337
Last active December 10, 2015 02:28
Amazing System 1ShoppingCart Form Boilerplate
<form name="form1" method="post" action="http://www.mcssl.com/app/contactsave.asp">
<div class="hidden-fields">
<input name="merchantid" type="hidden" value="%%MERCH_ID%%" />
<input name="ARThankyouURL" type="hidden" value="www.1shoppingcart.com/app/thankyou.asp?merchantid=%%MERCH_ID%%" />
<input name="copyarresponse" type="hidden" value="1" />
<input name="custom" type="hidden" id="custom" value="1" />
<input name="defaultar" type="hidden" value="%%DEFAULT_AR%%" />
<input name="allowmulti" type="hidden" value="0" />
<input name="visiblefields" type="hidden" value="Email1" />
<input name="requiredfields" type="hidden" value="Email1" />
http://davidfarr.com/click/all-night-graduation-parties.php?email=%$email$%&Name=%$name$%&Company=%$company$%&Workphone=%$workphone$%&Homephone=%$homephone$%&City=%$city$%&field9=%$custom:field9$%&field2=%$custom:field2$%&auto=yes
@gMagicScott
gMagicScott / filename-based-cache-busting.php
Last active December 16, 2015 07:39 — forked from BenSampo/filename-based-cache-busting.php
Bustin' up cache's in WordPress. Doing it H5BP style, and without a build script.
<?php
/**
* Plugin Name: Filename Based Cache Busting
* Plugin URI: https://gist.github.com/gMagicScott/5400268
* Description: Bustin' up cache's in WordPress. Doing it H5BP style, and without a build script.
* Author: Scott Lesovic, forked from Ben Sampo
* Author URI:
* Version: 0.2-dev
*/
<?php
//* ======================
// Turn Developer Mode On
// ======================
define('WP_DEBUG', true);
// Enable Debug logging to the /wp-content/debug.log file
define('WP_DEBUG_LOG', true);
@gMagicScott
gMagicScott / README.md
Last active March 23, 2021 09:56
Install CrashPlan for Linux without the hassle of all the interactive prompts. This uses all the defaults, except opening the GUI interface at the end.

CrashPlan Simple Install

CrashPlan is a great backup service allowing local, remote, and premium hosted backups. They even support Windows, Mac, and Linux.

While I can't speak to the install experience for Windows or Mac, on Linux, it's horrible.

It's an interactive install that doesn't take any flags to accept defaults. As a Ubuntu user, there is a new version every 6 months and to make the upgrade process easier, I bash script the installation of all my core programs so I can reformat and be back up an running with ease.

This bash script will download a recent version, untar it, and install it with all the defaults.

#!/usr/bin/env bash
for remote in `git branch -r | grep -v master `; do git checkout --track $remote ; done