Giter Club home page Giter Club logo

hng_storm-task's Introduction

  • ๐Ÿ‘‹ Hi, Iโ€™m @Seymaster
  • ๐Ÿ‘€ Iโ€™m interested in Typescript,NodeJs,Open Source Contribution, Website,Web Application,
  • ๐ŸŒฑ Iโ€™m currently learning GoLang
  • ๐Ÿ’ž๏ธ Iโ€™m looking to collaborate on Open Source
  • ๐Ÿ“ซ How to reach me via email [email protected]

hng_storm-task's People

Contributors

brianorinah avatar buraah avatar chukwuamaka avatar cyril411 avatar dav4thevid avatar david-brown01 avatar davidfayanju1 avatar destinyjunior avatar ekpono avatar esi-meci avatar gabaggrey avatar jelhill avatar jerry299 avatar john-thiaka avatar joshuafolorunsho avatar kangbreder avatar kansoldev avatar moscharrito avatar nerdpraise avatar olaitanlasisi avatar onshimiye avatar pepzini avatar phauziyah avatar precious3173 avatar rishika1802 avatar rowend36 avatar ruphai avatar sito-dev avatar udofiaofonime avatar yanmifeakeju avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

hng_storm-task's Issues

Provide necessary information

Please can the repo maintainers write a readme telling us what exactly our script is expected to console.log or print, either JSON or string.

Also we need to know in the readme, the branch that we are to push to. This will make things very easy for everybody. Thanks.

Set a Different Default Branch

We are supposed to set our working branch as the default branch, so that all PRs will be made to it. It is not good for PRs to be made to the master branch. I can see that many people are making their PRs to the master branch.

Notice: Undefined variable: filename

Notice: Undefined variable: filename in /Users/ambrose/Dev/hngi7/HNG_storm-task/index.php on line 90

Notice: Undefined index: QUERY_STRING in /Users/ambrose/Dev/hngi7/HNG_storm-task/index.php on line 94
error_reporting(E_ERROR | E_PARSE);

individual scripts returning JSON

Awesome work I've seen on the repo. I noticed the code for individual scripts in the scripts folder returns JSON as well as the string. I think since the instructions said the individual scripts should return strings alone, we should stick to that. Here's some code I've ran and tested that works well on my system for js, php, dart and python.

<?php
$log_directory = dirname(__FILE__);
// $files = [];
$path = $log_directory . '\scripts\*.*';

$output = array();
$res = array();
$fullnameRegex = "/\sis\s(.*)\swith/";
$idRegex = "/\sID\s(.*)\susing/";
$languageRegex = "/\susing\s(.*)\sfor/";

foreach (glob($path) as $key => $file) {
    $new = array();
    if (pathinfo($file)['extension'] == 'js') {
        exec("node $file", $output);
    } else if (pathinfo($file)['extension'] == 'py') {
        exec("python $file", $output);
    } else if (pathinfo($file)['extension'] == 'dart') {
        exec("dart $file", $output);
    } else if (pathinfo($file)['extension'] == 'php') {
        exec("php $file", $output);
    }

    if (preg_match("$fullnameRegex", $output[$key], $matches1)) {
        $new['full name'] = $matches1[1];
    }
    if (preg_match("$idRegex", $output[$key], $matches1)) {
        $new['ID'] = $matches1[1];
    }
    if (preg_match("$languageRegex", $output[$key], $matches1)) {
        $new['language'] = $matches1[1];
    }

    array_push($res, $new);
}

var_dump(json_encode($res, true));

The final result is:

string(256) "[{"full name":"[full dart]","ID":"[ID]","language":"[language]"},{"full name":"[full
js]","ID":"[ID]","language":"[language]"},{"full name":"[full php]","ID":"[ID]","language":"[language]"},{"full
name":"[full python]","ID":"[ID]","language":"[language]"}]"

Caching of results

We need to store the results down in a json file that will be loaded in index.php mapping files to results. Only files that are not in that json file will be 'exec'ed. Reason: I am using a phone to load the page. With just 6 scripts, it takes up to a 30 seconds to load. Let us say, a computer is 10 times faster ie 6 scripts in 3 seconds. If half of the team submits: 300 scripts. 300/6 * 3 = 150 seconds. One minute and 30 seconds. On some browsers, that classifies as a timeout. Think of it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.