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
/** | |
* Module Pattern Assignment Example | |
* @author Eric Hamilton | |
*/ | |
// Assign the return result of an anonymous self executing function to a public variable | |
var encapsulatedNamespace = (function () { | |
var privateVar = "Secret stuff", | |
privateFunction = function () { | |
var result; | |
// do something with privateVar |
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
/* Object.create() vs new Speed Test | |
* @author Eric Hamilton | |
* | |
* Result: For a few thousand objects, it | |
* doesn't matter which way you go. | |
* For hundreds of thousands of objects, | |
* you might want to use new instead of | |
* Object.create(). | |
* | |
* Tested on node v0.2.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
var myModule = (function () { | |
var myModule = { | |
"prop1" : "some value", | |
"prop2" : "some other value" | |
}; | |
myModule.someMethod = function () { | |
// Do stuff with props. | |
}; |
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
/* Works in browsers or in CommonJS environment. | |
* If you don't have either, just create an exports global before | |
* this loads and call it a day. | |
*/ | |
(function (root) { | |
var myModule = { | |
"prop1" : "some value", | |
"prop2" : "some other value" | |
}; |
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
node> "\\\\" | |
'\\\' | |
node> "1\/2\\3\\4\\5\\6\\" | |
'1/2\\3\\4\\5\\6\' | |
node> "1\/2\\3\\4\\5\\6" | |
'1/2\\3\\4\\5\\6' | |
:~/tmp# cat testme.js |
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
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> | |
<script src="jquery.h5validate.js"></script> | |
<script> | |
$(document).ready(function () { | |
$('form').h5Validate(); | |
}); | |
</script> |
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
<input id="name" name="name" type="text" placeholder="Bob" title="Your name is required." required /> |
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
<input id="name" name="name" type="text" placeholder="mm/dd/yyyy" title="mm/dd/yyyy" pattern="(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d" /> |
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
<head> | |
<style> | |
.black { | |
background-color:#111111; | |
color:silver; | |
} | |
</style> | |
</head> | |
<body> | |
<form id="black"> |
OlderNewer