Skip to content

Instantly share code, notes, and snippets.

View matherton's full-sized avatar

Mark Atherton matherton

View GitHub Profile
@matherton
matherton / jQuery Dialog Demo
Created March 24, 2014 12:28
Default jQuery Dialog demo with some close and open animations
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Dialog - Animation</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script>
@matherton
matherton / scripts
Created February 5, 2014 12:59
JS functions completed HKE
/* Start of live datepicker function */
var datePicker = $(function() {
$( "#from, #to" ).datepicker({
defaultDate: "+0w",
changeMonth: false,
dateFormat: 'mm-dd-yy',
numberOfMonths: 2,
minDate: 0, // the minimum selection date
onSelect: function( selectedDate ) {
@matherton
matherton / ajaxloaderdemo.html
Last active January 4, 2016 17:19
AJAX demo that loads a PHP script once the request has completed. I use MAMP but any server running APACHE and PHP would be fine.
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="custom-booking-search.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$(document).ajaxStart(function(){
$("#plane-border").css("display","block");
@matherton
matherton / HTML5template
Last active January 4, 2016 02:39
Basic HTML5 page template
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<!-- The page title that is displayed in the top of the browser -->
<title>The HTML5 Herald</title>
<!-- Meta content describes your page and is indexed by search engines such as Google -->
<meta name="description" content="The HTML5 BASE template">
@matherton
matherton / unlinked-search
Last active January 4, 2016 02:39
Bash script to find unlinked files in a directory
@matherton
matherton / test-jquery.html
Created January 22, 2014 10:25
Example of how to do a simple AJAX injection of a datepicker field on an onClick event. NOTE requires to be run on a server (I use Apache) and the file being injected is stored in a test folder.
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<link rel="stylesheet" href="../css/ui.css">
</head>
<body>
<div id="tempload"></div>
<button id="btntest" name="btntest">test</button>
@matherton
matherton / showHide.js
Last active December 29, 2015 00:28
Show and hide JS with no jQuery
function toggle(id) {
var element = document.getElementById(id);
if(element.style.display == "block")
hide(id);
else
show(id);
}
@matherton
matherton / GA.php
Last active December 23, 2015 19:29
GA E-commerce PHP tracking code
public function getGoogleAnalytics ()
{
$googleid = Config::getConfig()->getPreference('googleAnalyticsCode');
$basketWidget = $this->getWidget('basket');
$clientData = $this->getClientDataForOrderReview($clientID);
$orderData = $this->getOrderData($basketWidget,$clientData);
@matherton
matherton / drag.html
Created September 18, 2013 09:07
Draggable jQuery Div with callback functions (comments included)
<html>
<head>
<title>Dragable Demo</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<script src="ui.js"></script>
<style>
.item {
height: 180px;
@matherton
matherton / plugin structure -> DemoPlugin
Created June 28, 2013 09:09
Worpress OO Plugin template
// http://wp.tutsplus.com/tutorials/plugins/two-ways-to-develop-wordpress-plugins-object-oriented-progamming/
class My_Widget extends WP_Widget {
public function __construct() {
// widget actual processes
}
public function form( $instance ) {
// outputs the options form on admin