This file contains hidden or 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
const request = require("request"); | |
function requestPromiseStream(uri, requestOptions) { | |
return new Promise(function(resolve, reject) { | |
var req = request(uri, requestOptions); | |
req.on("error", reject); | |
req.on("response", function(res) { | |
// pause the stream so that it isn't flowing during the async promise hop | |
res.pause(); | |
if (res.statusCode !== 200) { |
This file contains hidden or 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
{ | |
"name": "async-iterator-with-json-stream", | |
"version": "0.1.0", | |
"description": "Use an async iterator or generator with streaming JSON.parse", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "Matt Morgis", | |
"license": "MIT", |
This file contains hidden or 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
{"contents":{"launch":{"version":"0.2.0","configurations":[{"name":"Python: Current File (Integrated Terminal)","type":"python","request":"launch","program":"${file}","console":"integratedTerminal","cwd":"${workspaceFolder}/02"}]}},"overrides":[],"keys":["launch.version","launch.configurations"]} |
This file contains hidden or 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, body { | |
height: 100%; | |
overflow: auto; | |
-webkit-overflow-scrolling: touch; | |
} |
This file contains hidden or 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 type="text/javascript"> | |
var total_images = 3; | |
var random_number = Math.floor((Math.random()*total_images)); | |
var random_img = new Array(); | |
random_img[0] = '<a href="http://google.com"><img src="http://domain.com/images/ad1.gif"></a>'; | |
random_img[1] = '<a href="http://google.com"><img src="http://domain.com/images/ad2.gif"></a>'; | |
random_img[2] = '<a href="http://google.com"><img src="http://domain.com/images/ad3.gif"></a>'; | |
document.write(random_img[random_number]); | |
</script> |