Skip to content

Instantly share code, notes, and snippets.

View jameshibbard's full-sized avatar

James Hibbard jameshibbard

View GitHub Profile
@jameshibbard
jameshibbard / gist:3697433
Created September 11, 2012 10:21
Canvas Lightbox Overlay - JavaScript - Example 2
// JavaScript Document
var room_336 = [409,397,68,36];
var room_339 = [409,302,68,36];
var room_340 = [409,269,68,36];
var room_342 = [409,207,68,36];
var room_343 = [409,176,68,36];
var room_348 = [379,82,35,65];
var room_394 = [585,461,35,65];
var room_588 = [92,82,35,65];
var room_591 = [126,82,35,65];
@jameshibbard
jameshibbard / gist:3831983
Created October 4, 2012 07:34
A Userscript file to create a button to open a subset of links on a webpage
// ==UserScript==
// @name Open CodeProject Links
// @namespace http://hibbard.eu/
// @version 0.1
// @description Opens all of the links from the CodeProject newsletter in one go
// @match http://www.codeproject.com/script/Mailouts/*
// @copyright 2012+, hibbard.eu
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==
@jameshibbard
jameshibbard / gist:3884319
Created October 13, 2012 11:52
HTML document containing some random text
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Tooltip demo</title>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<style>#container{ width:600px; margin: 0 auto; padding-top:50px; }</style>
</head>
<body>
@jameshibbard
jameshibbard / gist:3884614
Created October 13, 2012 13:23
Tooltip demo using aToolTip
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Tooltip demo</title>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="path-to-jquery.atooltip.js"></script>
<link type="text/css" href="path-to-atooltip.css" rel="stylesheet" media="screen" />
<style>#container{ width:600px; margin: 0 auto; padding-top:50px; }</style>
</head>
@jameshibbard
jameshibbard / gist:4143381
Created November 25, 2012 12:51
A session-based visitor counter
<?php
session_start();
$counter_name = "counter.txt";
// Check if a text file exists. If not create one and initialize it to zero.
if (!file_exists($counter_name)) {
$f = fopen($counter_name, "w");
fwrite($f,"0");
fclose($f);
}
@jameshibbard
jameshibbard / gist:4147409
Created November 26, 2012 09:39
A simple visitor counter
<?php
session_start();
$counter_name = "counter.txt";
// Check if a text file exists. If not create one and initialize it to zero.
if (!file_exists($counter_name)) {
$f = fopen($counter_name, "w");
fwrite($f,"0");
fclose($f);
}
@jameshibbard
jameshibbard / gist:4246581
Created December 9, 2012 19:09
Two select menus with which a user can choose background and text colour
<p>Select the background colour:
<select class="selector">
<option value="background-default">Default</option>
<option value="background-blue">Blue</option>
<option value="background-green">Green</option>
<option value="background-red">Red</option>
</select>
</p>
<p>Select the text colour:
@jameshibbard
jameshibbard / gist:4246669
Created December 9, 2012 19:36
CSS styles for a simple style changer
body{color:#000; background:#fff;}
.background-blue{background:blue;}
.background-red{background:red;}
.background-green{background:green;}
.color-yellow, .color-yellow a{color:yellow;}
.color-white, .color-white a{color:white;}
.color-purple, .color-purple a{color:purple}
@jameshibbard
jameshibbard / gist:4246886
Created December 9, 2012 20:40
A simple style changer using cookies
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Style changer - Page 1</title>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script src="jquery.cookie.js"></script>
<style>
body{color:#000; background:#fff;}
.background-blue{background:blue;}
@jameshibbard
jameshibbard / gist:4363489
Last active December 10, 2015 01:58
Simple unordered list to be marked up as a menu
<ul id="myMenu">
<li id="blog"><a href="/blog">Blog</a></li>
<li id="humor"><a href="/humor">Humor</a></li>
<li id="consulting"><a href="/consulting">Consulting</a></li>
<li id="contact"><a href="/contact">Contact</a></li>
</ul>