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
/** | |
* progressive shim to defer execution until next run-loop cycle | |
* | |
* prefers | |
* - `process.nextTick` over | |
* - `process.setImmediate` or `window.setImmediate` over | |
* - `window.requestAnimationFrame` over | |
* - `window.postMessage` and `window.addEventListener` over | |
* - `setTimeout` as the very last resort | |
*/ |
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 http = require('http'); | |
var server = http.createServer(function(req, res) { | |
// console.log(req); // debug dump the request | |
// If they pass in a basic auth credential it'll be in a header called "Authorization" (note NodeJS lowercases the names of headers in its request object) | |
var auth = req.headers['authorization']; // auth is in base64(username:password) so we need to decode the base64 | |
console.log("Authorization Header is: ", auth); |
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
javascript:(function(){ | |
this.write('<!DOCTYPE html>\ | |
<html>\ | |
<head>\ | |
<meta charset="UTF-8"/>\ | |
<script src="http://localhost:8000/path/to/your/script.js"></script>\ | |
</head>\ | |
<body></body>\ | |
</html>'); | |
this.close() |
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
/*! | |
* is, released under MIT licence | |
* http://mariusrunge.com/mit-licence.html | |
* inspired by / partially taken from underscorejs.org | |
* | |
* how to use: | |
* - comment the code-sections and/or `classNames` you don't need | |
* - integrate `is` into your lib via the `.noConflict()` option | |
* - eventually clean up the global namespace via `delete window.is` (try-catch for IE) | |
* |
NewerOlder