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
public static IEnumerable<double> Eurekas(double a, double b) | |
{ | |
for (;a <= b;a++) | |
if (a.ToString().Select((c, i) => Math.Pow(Char.GetNumericValue(c), i + 1)).Sum() == a) | |
yield return a; | |
} |
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 for batch installing Visual Studio Code extensions | |
# Specify extensions to be checked & installed by modifying $extensions | |
$extensions = | |
"DotJoshJohnson.xml", | |
"EditorConfig.EditorConfig", | |
"HookyQR.beautify", | |
"Leopotam.csharpfixformat", | |
"ecmel.vscode-html-css", | |
"formulahendry.auto-close-tag", |
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
{"lastUpload":"2020-06-23T12:25:19.840Z","extensionVersion":"v3.4.3"} |
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
using System; | |
using System.Threading.Tasks; | |
using Microsoft.AspNetCore.Mvc; | |
namespace MedsProcessor.WebAPI.Controllers | |
{ | |
[ApiController, Route("~/")] | |
public class AppController : ControllerBase | |
{ | |
public ActionResult Index() |
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
using AngleSharp; | |
namespace MedsProcessor.Scraper | |
{ | |
public class HzzoHtmlScraper | |
{ | |
readonly IBrowsingContext _browsingContext; | |
public HzzoHtmlScraper(IBrowsingContext browsingContext) | |
{ |
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
using AngleSharp; | |
using Microsoft.Extensions.DependencyInjection; | |
namespace MedsProcessor.Scraper | |
{ | |
public static class ServiceCollectionExtensions | |
{ | |
public static IServiceCollection AddAngleSharp(this IServiceCollection services) => | |
services.AddSingleton(BrowsingContext.New( | |
AngleSharp.Configuration.Default.WithDefaultLoader())); |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using MedsProcessor.Scraper; | |
using Microsoft.AspNetCore.Builder; | |
using Microsoft.AspNetCore.Hosting; | |
using Microsoft.AspNetCore.HttpsPolicy; | |
using Microsoft.AspNetCore.Mvc; | |
using Microsoft.Extensions.Configuration; |
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
public async Task<ISet<HzzoMedsDownloadDto>> Run() | |
{ | |
var htmlDocs = await DownloadHtmlDocuments(); | |
var parsedDocs = ParseHtmlDocuments(htmlDocs); | |
return parsedDocs; | |
} |
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
Task<IDocument[]> DownloadHtmlDocuments() => | |
Task.WhenAll( | |
_browsingContext.OpenAsync(CURRENT_LISTS_URL), | |
_browsingContext.OpenAsync(ARCHIVE_LISTS_URL) | |
); |
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
namespace MedsProcessor.Common | |
{ | |
public static class Constants | |
{ | |
public const string CURRENT_LISTS_URL = "http://www.hzzo.hr/zdravstveni-sustav-rh/trazilica-za-lijekove-s-vazecih-lista/"; | |
public const string ARCHIVE_LISTS_URL = "http://www.hzzo.hr/zdravstveni-sustav-rh/trazilica-za-lijekove-s-vazecih-lista/arhiva-liste-lijekova/"; | |
public const string DOWNLOAD_DIR = ""; | |
} | |
} |