This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This class allows the creation of a simple slideshow. | |
It requires an array of image locations and a target element ID. | |
It does not fade images, simply substitutes the background-image property. | |
*/ | |
var slideshow = function() | |
{ | |
var self = this; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This code will validate all elements in a form (elements that are included in form.elements, that is). | |
By "Validate", it is meant that the field is not empty. No additional checks are made such as for valid email addresses, | |
phone numbers or anything similar. Any empty / failed fields will be given a red border color and text before an alert appears informing the user that they need to complete the stated fields */ | |
function validateForm(form) | |
{ | |
var error_count = 0; // Holds the amount of errors | |
var error_list = new Array(); // The array (list) of errors found. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Original code from http://www.webmasterworld.com/forum88/9769.htm, tweaked to accomodate for shorthand hex (#fff) | |
*/ | |
function get_contrasting_colour($hex) { | |
$hex = str_replace('#', '', $hex); | |
$l=2; | |
if(strlen($hex==3)){$l=1;} | |
$c_r = hexdec(substr($hex, 0, $l)); | |
$c_g = hexdec(substr($hex, 2, $l)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Takes an associative array and converts them to HTML element attributes | |
*/ | |
function array_to_attr($attrs) { | |
$r=""; | |
if(is_array($attrs)) { | |
foreach($attrs as $attr => $val) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Modified from http://stackoverflow.com/questions/14560999/using-the-haversine-formula-in-javascript */ | |
function toRad(v){return v * Math.PI / 180;} | |
function kmToMiles(km) {return (km * 0.62137).toFixed(2);} | |
var l1 = LatLong(0,0); | |
var l2 = LatLong(0,0); | |
function LatLong(lat, lon) { | |
return {Latitude: lat, Longitude: lon} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nodes" : [ | |
{"name":"test","1990":20, "1991":22, "1992":19}, | |
{"name":"test2","1990":10, "1991":12, "1992":16}, | |
{"name":"test3","1990":6, "1991":22, "1992":30} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@charset "utf-8"; | |
/*! normalize.css v1.1.0 | MIT License | git.io/normalize */ | |
article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block;*display:inline;*zoom:1}audio:not([controls]){display:none;height:0}[hidden]{display:none}html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}html,button,input,select,textarea{font-family:sans-serif}body{margin:0}a:focus{outline:thin dotted}a:active,a:hover{outline:0}h1{font-size:2em;margin:.67em 0}h2{font-size:1.5em;margin:.83em 0}h3{font-size:1.17em;margin:1em 0}h4{font-size:1em;margin:1.33em 0}h5{font-size:.83em;margin:1.67em 0}h6{font-size:.67em;margin:2.33em 0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}blockquote{margin:1em 40px}dfn{font-style:italic}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}mark{background:#ff0;color:#000}p,pre{margin:1em 0}code,kbd,pre,samp{font-family:monospace,serif;_font-family:'courier new',monospace;f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if(strpos($_SERVER['HTTP_USER_AGENT'],'FBAN')){ ?> | |
Looks like you're in the Facebook app, yo. | |
<?php } ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function tableFromObjectArray(arr) { | |
var tStr = "<table>"; | |
tStr+="<thead><tr>"; | |
for(prop in arr[0]) { | |
tStr+="<td>"+prop+"</td>"; | |
} | |
tStr+="</tr></thead>"; | |
for(var i=0;i<arr.length;i++) { | |
tStr+="<tr>"; | |
for(prop in arr[i]) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
innodb_autoinc_lock_mode=0 |
OlderNewer