Skip to content

Instantly share code, notes, and snippets.

View jameshibbard's full-sized avatar

James Hibbard jameshibbard

View GitHub Profile
@jameshibbard
jameshibbard / get_employee_data_1.html
Last active December 30, 2015 02:59
Get employee data via AJAX (1)
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>AJAX filter demo</title>
</head>
<body>
<h1>Temporary Worker Database</h1>
<div id="workers"></div>
@jameshibbard
jameshibbard / simple_calendar.html
Created October 22, 2013 09:00
Simple jQuery calendar plugin
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
#calendar{ font-size:14px; }
.day{
display: inline-block;
@jameshibbard
jameshibbard / birthday.rb
Last active December 22, 2015 13:19
Demonstrates the use of virtual attributes to create form fields that do not map directly to the database
class Birthday < ActiveRecord::Base
attr_accessible :date, :name, :day, :month, :year
before_validation :make_date
def day
(date.nil?)? @day : date.split("-")[0]
end
def month
(date.nil?)? @month : date.split("-")[1]
@jameshibbard
jameshibbard / tampermonkey_form_demo.html
Last active January 18, 2018 21:47
Tamper monkey form demonstration
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Tampermonkey form auto-fill</title>
<style>
label{display: inline-block; margin:5px 0px;}
</style>
</head>
@jameshibbard
jameshibbard / gist:5540481
Last active December 17, 2015 03:08
Use jQuery Deferred to chain asynchronous tasks
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Play sound after countdown</title>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<style>
#count{
color: blue;
font-size:70px;
@jameshibbard
jameshibbard / gist:5344470
Last active December 15, 2015 23:59
PHP script for siple unit converter
<?php
$amount = $_POST['amount'];
$from = $_POST['from'];
$into = $_POST['into'];
$step = $from - $into;
echo pow((2),$step*10)*$amount;
?>
@jameshibbard
jameshibbard / gist:5344451
Last active December 15, 2015 23:59
Simple AJAX unit converter
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>AJAX unit Converter</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<style>
#myForm div{margin-bottom:15px;}
#result{border:solid 1px green; background: #6F9; margin-top:25px; padding:7px; display:none;}
</style>
@jameshibbard
jameshibbard / gist:5344406
Last active December 15, 2015 23:59
Form for simple AJAX unit converter
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>AJAX unit Converter</title>
<style>
#myForm div{margin-bottom:15px;}
#result{border:solid 1px green; background: #6F9; margin-top:25px; padding:7px; display:none;}
</style>
</head>
@jameshibbard
jameshibbard / gist:4984475
Created February 19, 2013 09:47
Basic mark-up for jQuery sliding panels example
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>jQuery sliding panels example</title>
</head>
<body>
<div id="wrapper">
<div id="menu_panel">
@jameshibbard
jameshibbard / gist:4703380
Created February 3, 2013 19:54
Simple addition with JavaScript
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Simple addition</title>
</head>
<body>
<p>Two times two is: <span id="result"></span><p>