-
Notifications
You must be signed in to change notification settings - Fork 333
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from DreyWesson/master
Change index.php
- Loading branch information
Showing
37 changed files
with
456 additions
and
54 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# Created by eadortsu | ||
### Node template | ||
# Logs | ||
/logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
# next.js build output | ||
.next | ||
|
||
# nuxt.js build output | ||
.nuxt | ||
|
||
# Nuxt generate | ||
dist | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless | ||
|
||
# IDE / Editor | ||
.idea | ||
|
||
# Service worker | ||
sw.* | ||
|
||
# macOS | ||
.DS_Store | ||
|
||
# Vim swap files | ||
*.swp |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,22 @@ | ||
# team-superman-hngi7 | ||
# Team-superman-hngi7 (Superman's repo for HNGi7) | ||
|
||
# GUIDE LINES FOR WRITING YOUR SCRIPT: | ||
## 1. Do NOT embed your script inside any form of html | ||
|
||
## 2. Use simple logging functions. | ||
### For javaScript - console.log() | ||
### for python - print(), | ||
### for php - echo. | ||
|
||
## 3. Use this EXACT string format - "Hello World, this is [full name] with HNGi7 ID [ID] using [language] for stage 2 task". Do not add colon ( : ), Dash (-) or any other character. | ||
## 4. Replace everything inside the square brackets including the square brackets, with the correct values. | ||
|
||
## 5. I REPEAT DO NOT ADD ANY OTHER CHARACTER TO IT, JUST REPLACE THE APPROPRIATE VALUES. | ||
|
||
## 6. Save your file with a UNIQUE name. your username should be unique enough. | ||
|
||
# RESULTS SO FAR | ||
|
||
[Result page](https://ndubuisijr.github.io/superman-results) | ||
|
||
Your DESTINY is in your hands o... |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,126 @@ | ||
<?php | ||
$files = scandir('scripts'); | ||
if($files) { | ||
foreach($files as $file) { | ||
echo 'File: '.$file.'<br />'; | ||
|
||
unset($output); | ||
if(preg_match('/.php$/i', $file)){ | ||
$output = exec('php scripts/'.$file); | ||
} elseif(preg_match('/.py$/i', $file)) { | ||
$output = exec('python scripts/'.$file); | ||
} elseif(preg_match('/.js$/i', $file)) { | ||
$output = exec('node scripts/'.$file); | ||
$files = array_filter(scandir('scripts'), function ($script) { | ||
return !is_dir('scripts/' . $script); | ||
}); // To remove "." and ".." from the array output os scabdir | ||
|
||
$final = []; | ||
if ($files) { | ||
foreach ($files as $file) { | ||
$script = []; | ||
$script['file'] = $file; | ||
if (preg_match('/.php$/i', $file)) { | ||
$output = exec('php -f scripts/' . $file .' 2>&1'); | ||
} elseif (preg_match('/.py$/i', $file)) { | ||
$output = exec('python scripts/' . $file); | ||
} elseif (preg_match('/.js$/i', $file)) { | ||
$output = exec('node scripts/' . $file); | ||
} | ||
|
||
if(isset($output)) { | ||
echo 'Output: '.$output.'<br />'; | ||
$result = []; | ||
preg_match('/^Hello World, this is ([a-zA-Z -]*) with HNGi7 ID ((HNG-|)[0-9]{1,5}) using (Python|PHP|JavaScript|Node.js) for stage 2 task(.|)$/i', $output, $result); | ||
if(count($result) > 0) { | ||
echo 'Name: '.$result[1].'<br />'; | ||
echo 'HNGi7 ID: '.$result[2].'<br />'; | ||
echo 'Language: '.$result[4].'<br />'; | ||
echo 'Result: Passed, congrats!!!'; | ||
if (isset($output)) { | ||
$mainOutput=substr($output,0,strpos($output,".")); | ||
$script['output'] = $mainOutput; | ||
$result = []; | ||
preg_match('/^Hello World, this is ([a-zA-Z -]*) with HNGi7 ID ((HNG-|)[0-9]{1,5}) using (Python|PHP|JavaScript|Node.js) for stage 2 task(.|)$/i', $mainOutput, $result); | ||
if (count($result) > 0) { | ||
$script['name'] = $result[1]; | ||
$script['id'] = $result[2]; | ||
$script['language'] = $result[4]; | ||
$script['status'] = 'Pass'; | ||
$script['email']=substr($output,strpos($output,".")+1); | ||
} else { | ||
echo 'Result: Fail :('; | ||
$script['name'] = ""; | ||
$script['id'] = ""; | ||
$script['language'] = ""; | ||
$script['status'] = 'Fail'; | ||
$script['email']=''; | ||
} | ||
} else { | ||
echo 'Result: Fail :('; | ||
|
||
array_push($final, $script); | ||
|
||
} | ||
|
||
echo '<br /><br />'; | ||
} | ||
} | ||
if (!isset($_GET['json'])) { | ||
?> | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
|
||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
<meta name="description" content=""> | ||
<meta name="author" content=""> | ||
|
||
<title>Team Superman- Task 2</title> | ||
|
||
<!-- Bootstrap core CSS --> | ||
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet"> | ||
<link href="//cdn.datatables.net/1.10.21/css/jquery.dataTables.min.css" rel="stylesheet"> | ||
|
||
</head> | ||
|
||
<body> | ||
|
||
<!-- Navigation --> | ||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark static-top"> | ||
<div class="container"> | ||
<a class="navbar-brand" href="#">Team Superman- Task 2</a> | ||
</div> | ||
</nav> | ||
|
||
<!-- Page Content --> | ||
<main role="main" class="container"> | ||
<div class="my-3 p-3 bg-white rounded shadow-sm"> | ||
<h6 class="border-bottom border-gray pb-2 mb-0">Scripts Results</h6> | ||
<table id="table" class="table table-striped table-bordered"> | ||
<thead> | ||
<tr> | ||
<th>Status</th> | ||
<th>Output</th> | ||
<th>File Name</th> | ||
<th>Name</th> | ||
<th>Language</th> | ||
<th>ID</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<?php foreach ($final as $script) { ?> | ||
<tr> | ||
<td><?=$script['status']=='Pass'? '<span class="badge badge-success">Pass</span>': '<span class="badge badge-danger">Fail</span>' ?></td> | ||
<td><?=$script['output']?></td> | ||
<td><?=$script['file']?></td> | ||
<td><?=$script['name']?></td> | ||
<td><?=$script['language']?></td> | ||
<td><?=$script['id']?></td> | ||
|
||
</tr> | ||
<?php } ?> | ||
</tbody> | ||
</table> | ||
</div> | ||
</main> | ||
|
||
<!-- Bootstrap core JavaScript --> | ||
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" | ||
integrity="sha256-4+XzXVhsDmqanXGHaHvgh1gMQKX40OUvDEBTu8JcmNs=" crossorigin="anonymous"></script> | ||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script> | ||
<script src="//cdn.datatables.net/1.10.21/js/jquery.dataTables.min.js"></script> | ||
<script> | ||
$(document).ready(function () { | ||
$('#table').DataTable(); | ||
}); | ||
</script> | ||
</body> | ||
|
||
</html> | ||
<?php | ||
|
||
} else { | ||
|
||
//return the json response : | ||
header('Content-Type: application/json'); // <-- header declaration | ||
echo json_encode($final, true); // <--- encode | ||
exit(); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
|
||
<p id="demo"></p> | ||
|
||
<script> | ||
|
||
document.getElementById("demo").innerHTML = "Hello World, this is Claire Munyole with HNGi7 ID HNG-00045 using JavaScript for stage 2 task"; | ||
|
||
</script> | ||
|
||
</body> | ||
</html> | ||
console.log("Hello World, this is Claire Munyole with HNGi7 ID HNG-00045 using JavaScript for stage 2 task"); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
function firstTask(fName, hId, lang) { | ||
console.log( | ||
`Nice Meeting you Here! This is ${fName} with HNGi7 ID of ${hId} using ${lang} for this stage task` | ||
); | ||
} | ||
firstTask("Egbo Emmanuel", "HNG-04843", "Javascript"); | ||
|
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
var info = function(fullname, id, language) { | ||
return `Hello World, this is ${fullname} with HNGi7-ID ${id} using ${language} for stage 2 task` | ||
|
||
} | ||
let newInfo = info("Emmanuel Udoh", "HNG-02600", "Javascript"); | ||
console.log(newInfo) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
const name = "Emmanuel Eboh"; | ||
const id = "HNG-01574"; | ||
const lang = "JavaScript"; | ||
console.log( | ||
`Hello World, this is ${name} with ${id} using ${lang} for stage 2 task.` | ||
); | ||
<<<<<<< HEAD:scripts/Emmanuel_Eboh.js | ||
======= | ||
</script> | ||
</html> | ||
>>>>>>> 61a28bfd62ddbaea8f710952e406e873c1f34f91:scripts/Emmanuel.Eboh.js |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
print("Hello World, this is {0} with HNGi7 ID {1} using {2} for stage 2 task".format('Francis Duru', 'HNG-290', 'Python')) | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
let fullName = 'Ajayi John'; | ||
let ID = 'HNG-00374'; | ||
let language = 'javascript'; | ||
|
||
console.log(`Hello World, this is ${fullName} with HNG ID ${ID} using ${language} for stage 2 task`); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
function Intern(name, hngId, devLanguage, email){ | ||
this.DevName=name; | ||
this.hngId = hngId; | ||
this.language=devLanguage; | ||
this.email=email; | ||
} | ||
|
||
function sayHelloToHNG(name, Id, language,email){ | ||
console.log(`Hello World, this is ${name} with HNGi7 ID ${Id} using ${language} for stage 2 task.${email}`) | ||
} | ||
|
||
let devName="Ndubuisi Jr Chukuigwe"; | ||
let devId="HNG-00214"; | ||
let devlanguage="JavaScript"; | ||
let devEmail="[email protected]"; | ||
let intern=new Intern(devName, devId, devlanguage,devEmail); | ||
sayHelloToHNG(intern.DevName, intern.hngId, intern.language,intern.email); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
print("Hello World, this is Richmond Ayitey with HNGi7 ID [HNG-00234] using Python language for HNGi7 task 2.") |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
print("Hello World, this is %s with HNGi7 ID %s using %s for stage 2 task" %("Similoluwa Okunowo","HNG02950","Python")) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Created on Wed Jun 3 01:48:52 2020 | ||
@author: Tobechi Chukwuleta | ||
""" | ||
|
||
import sys | ||
def my_script(): | ||
print('Hello World, this is %s with HNGi7 ID %s using %s language for stage 2 task.' % ('Chukwuleta Tobechi', 'HNG-03085', 'Python')) | ||
|
||
my_script() | ||
sys.stdout.flush() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
const aaloleHngDetails = (name, id, lang) => | ||
`Hello World.\n This is ${name},\n with HNGi7 ID ${id},\n using ${lang} for stage two task`; | ||
|
||
console.log(aaloleHngDetails("Rasheed Mikail Abiodun", "HNG-02286", "JavaScript")); |
Oops, something went wrong.