Skip to content

Instantly share code, notes, and snippets.

View jimthoburn's full-sized avatar

Jim Thoburn jimthoburn

View GitHub Profile
@jimthoburn
jimthoburn / within.js
Created September 11, 2013 22:18
A JavaScript function that will tell you if an element is within another element. This is useful for things like closing a widget when a user clicks somewhere else in the page.
function within(needle, haystack) {
// If the parent element is the target
if (needle === haystack) {
return true;
// If any of the children are the target
} else if (haystack.firstChild) {
var child = haystack.firstChild;
do {

The Unwritten History of Captain Sally

Some things about Captain Sally and how amazing she was!

  • This is the first thing that happened
  • And then this
  • And that too

And here is the hospital where she worked:

<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Demo</title>
</head>
<body>
<?php
// KUDOS: http://www.php.net/manual/en/features.file-upload.post-method.php#example-354
@jimthoburn
jimthoburn / dabblet.css
Created April 12, 2012 00:36
SVG Gradient Example
/**
* SVG Gradient Example
*/
a, button {
background: rgb(222, 103, 35) url(data:image/svg+xml;base64,Cjxzdmcgd2lkdGg9IjUwMHB4IiBoZWlnaHQ9IjUwMHB4IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogPGRlZnM+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkaWVudCIgeDE9IjAuNSIgeTE9IjAiIHgyPSIwLjUiIHkyPSIxIj4KICAgPHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSJyZ2IoMjQ2LCAxNzUsIDMyKSIgLz4KICAgPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSJyZ2IoMjIyLCAxMDMsIDM1KSIgLz4KICA8L2xpbmVhckdyYWRpZW50PgogPC9kZWZzPgogPGc+CiAgPHJlY3QgZmlsbD0idXJsKCNncmFkaWVudCkiIHN0cm9rZS13aWR0aD0iMCIgeD0iMCIgeT0iMCIgd2lkdGg9IjUwMCIgaGVpZ2h0PSI1MDAiIC8+CiA8L2c+Cjwvc3ZnPgogICAg) top repeat-x;
background-size: contain;
border-radius: 0.25em;
border-width: 0;
color: white;
display: inline-block;
@jimthoburn
jimthoburn / dabblet.css
Created April 9, 2012 04:32
SVG Gradient Example
/**
* SVG Gradient Example
*/
a, button {
background: rgb(222, 103, 35) url(data:image/svg+xml;base64,Cjxzdmcgd2lkdGg9IjUwMHB4IiBoZWlnaHQ9IjUwMHB4IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogPGRlZnM+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkaWVudCIgeDE9IjAuNSIgeTE9IjAiIHgyPSIwLjUiIHkyPSIxIj4KICAgPHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSJyZ2IoMjQ2LCAxNzUsIDMyKSIgLz4KICAgPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSJyZ2IoMjIyLCAxMDMsIDM1KSIgLz4KICA8L2xpbmVhckdyYWRpZW50PgogPC9kZWZzPgogPGc+CiAgPHJlY3QgZmlsbD0idXJsKCNncmFkaWVudCkiIHN0cm9rZS13aWR0aD0iMCIgeD0iMCIgeT0iMCIgd2lkdGg9IjUwMCIgaGVpZ2h0PSI1MDAiIC8+CiA8L2c+Cjwvc3ZnPgogICAg) top repeat-x;
background-size: contain;
border-radius: 0.25em;
border-width: 0;
color: white;
display: inline-block;