Revisions
-
robotlolita revised this gist
Aug 28, 2015 . 2 changed files with 15 additions and 16 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,16 +0,0 @@ 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ (* Assume bhttp-get is available here somehow *) let HTTP = { def get: url (* This would actually need to be imported properly. Yeah, FFI sucks, but oh well... *) Task from-promise: (FFI invoke: bhttp-get in-context: unit with-arguments: [FFI export: url]) } do { response <- HTTP get: "http://somesite.com/all-the-urls.txt"; url <- response at: "body" >> as-string >> split: "\n"; HTTP get: url } recover: { error | Console log!: error } -
joepie91 revised this gist
Aug 24, 2015 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -11,4 +11,6 @@ Promise.try(function(){ return response.body; }).then(function(arrayOfResponses){ /* arrayOfResponses now contains all the HTTP responses for each URL in the all-the-urls.txt file! */ }).catch(function(err){ console.log("An error occurred!", err); }) -
joepie91 revised this gist
Aug 14, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ var bhttp = require("bhttp"); Promise.try(function(){ return bhttp.get("http://somesite.com/all-the-urls.txt"); }).then(function(response){ return response.body.toString().split("\n"); }).map(function(url){ return bhttp.get(url); }).map(function(response){ -
joepie91 created this gist
Aug 6, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ var Promise = require("bluebird"); var bhttp = require("bhttp"); Promise.try(function(){ return bhttp.get("http://somesite.com/all-the-urls.txt"); }).then(function(response){ return response.body.toString.split("\n"); }).map(function(url){ return bhttp.get(url); }).map(function(response){ return response.body; }).then(function(arrayOfResponses){ /* arrayOfResponses now contains all the HTTP responses for each URL in the all-the-urls.txt file! */ })