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(){ | |
var reversedSet = $("li").get().reverse(); | |
//Use get() to return an array of elements, and then reverse it | |
$(reversedSet).each(function(){ | |
//Now we can plug our reversed set right into the each function. Could it be easier? | |
}); | |
}); |
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(){ | |
//Loop through each title | |
$("h3").each(function(){ | |
var content = $(this).text().split(" "); | |
var widow = " "+content.pop(); | |
$(this).html(content.join(" ")+widow); | |
}); | |
}); |
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
var searchArray = document.location.search.substring(1).split("&"); | |
//Take off the '?' and split into separate queries | |
//Now we'll loop through searchArray and create an associative array (object literal) called GET | |
var GET = []; | |
for (var searchTerm in searchArray){ | |
searchTerm.split("="); //Divide the searchTerm into property and value | |
GET[searchTerm[0]] = searchTerm[1]; //Add property and value to the GET array | |
} |
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(){ | |
jQuery.extend(jQuery.expr[':'], { | |
'child-of' : function(a,b,c) { | |
return (jQuery(a).parents(c[3]).length > 0); | |
} | |
}); | |
//'child-of' is now a valid selector: | |
$("li:child-of(ul.test)").css("background","#000"); | |
}); |
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
// output headers so that the file is downloaded rather than displayed | |
header('Content-Type: text/csv; charset=utf-8'); | |
header('Content-Disposition: attachment; filename=data.csv'); | |
// create a file pointer connected to the output stream | |
$output = fopen('php://output', 'w'); | |
// output the column headings | |
fputcsv($output, array('Column 1', 'Column 2', 'Column 3')); |
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
/* | |
CapsLock.js | |
An object allowing the status of the caps lock key to be determined | |
Created by Stephen Morley - http://code.stephenmorley.org/ - and released under | |
the terms of the CC0 1.0 Universal legal code: | |
http://creativecommons.org/publicdomain/zero/1.0/legalcode |
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 ($) { | |
$.fn.validateEmail = function () { | |
return this.each(function () { | |
var $this = $(this); | |
$this.change(function () { | |
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; | |
if ($this.val() == "") { | |
$this.removeClass("badEmail").removeClass("goodEmail") | |
}else if(reg.test($this.val()) == false) { |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> | |
<title>Google Maps Multiple Markers</title> | |
<script src="http://maps.google.com/maps/api/js?sensor=false" | |
type="text/javascript"></script> | |
</head> | |
<body> | |
<div id="map" style="width: 500px; height: 400px;"></div> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<title>Multiple Markers Google Maps</title> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> | |
<script src="https://maps.googleapis.com/maps/api/js?v=3.11&sensor=false" type="text/javascript"></script> | |
<script type="text/javascript"> | |
// check DOM Ready |
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
jQuery(function($) { | |
// Asynchronously Load the map API | |
var script = document.createElement('script'); | |
script.src = "//maps.googleapis.com/maps/api/js?sensor=false&callback=initialize"; | |
document.body.appendChild(script); | |
}); | |
function initialize() { | |
var map; | |
var bounds = new google.maps.LatLngBounds(); |