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"> | |
<title>Untitled</title> | |
<!--[if lt IE 9]> | |
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> | |
<![endif]--> | |
</head> | |
<body> |
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
<form action="http://maps.google.com/maps" method="get" target="_blank"> | |
<label for="saddr">Enter your location</label> | |
<input type="text" name="saddr" /> | |
<input type="hidden" name="daddr" value="350 5th Ave New York, NY 10018 (Empire State Building)" /> | |
<input type="submit" value="Get directions" /> | |
</form> |
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
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"> |
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
// When ready... | |
window.addEventListener("load",function() { | |
// Set a timeout... | |
setTimeout(function(){ | |
// Hide the address bar! | |
window.scrollTo(0, 1); | |
}, 0); | |
}); |
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
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/> |
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
// Listen for orientation changes | |
window.addEventListener("orientationchange", function() { | |
// Announce the new orientation number | |
console.log(window.orientation); | |
// 0 means portrait, 90 means landscape rotated to the left, -90 means landscape rotated to the right | |
}, 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
// HTML: | |
// <h1 id="anchor">Lorem Ipsum</h1> | |
// <p><a href="#anchor" class="topLink">Back to Top</a></p> | |
$(document).ready(function() { | |
$("a.topLink").click(function() { | |
$("html, body").animate({ | |
scrollTop: $($(this).attr("href")).offset().top + "px" |
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
$('#pass').keyup(function(e) { | |
var strongRegex = new RegExp("^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\W).*$", "g"); | |
var mediumRegex = new RegExp("^(?=.{7,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$", "g"); | |
var enoughRegex = new RegExp("(?=.{6,}).*", "g"); | |
if (false == enoughRegex.test($(this).val())) { | |
$('#passstrength').html('More Characters'); | |
} else if (strongRegex.test($(this).val())) { | |
$('#passstrength').className = 'ok'; | |
$('#passstrength').html('Strong!'); | |
} else if (mediumRegex.test($(this).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
function data_uri($file, $mime) { | |
$contents=file_get_contents($file); | |
$base64=base64_encode($contents); | |
echo "data:$mime;base64,$base64"; | |
} |
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 ordinal($cdnl){ | |
$test_c = abs($cdnl) % 10; | |
$ext = ((abs($cdnl) %100 < 21 && abs($cdnl) %100 > 4) ? 'th' | |
: (($test_c < 4) ? ($test_c < 3) ? ($test_c < 2) ? ($test_c < 1) | |
? 'th' : 'st' : 'nd' : 'rd' : 'th')); | |
return $cdnl.$ext; | |
} | |
for($i=1;$i<100;$i++){ | |
echo ordinal($i).'<br>'; | |
} |
OlderNewer