Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Natalie Kendall-Challenge1&2 #92

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions about.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="companystyle.css">
<script src="https://www.google.com/recaptcha/api.js"></script>
<link rel="icon" href="logo.png"/>
<title>About The Company</title>

<script type="text/javascript">

<!-- This function hides objects marked to be hidden until clicked -->
function hideInfo(){
var hidden = document.getElementsByClassName("hide");
var j;
for (j = 0; j < hidden.length; j++){
hidden[j].style.display = "none";
}
}

<!-- This function shows a hidden element when the element before is clicked -->
function viewInfo(id){
id.nextSibling.nextSibling.style.display="";
}
</script>
</head>

<body onload="hideInfo()">

<div class="header">
<img id="logo" src="logo.png" height="180px" width="180px">
<h2 id="frontpage">About<br />Us</h2>
<img id="headimg" src="business.jpg" height="180px" width="675px">
</div>

<div class="topnav">
<ul class="listnav">
<li class="nav"><a href="website.html">Home</a></li>
<li class="nav"><a href="about.html">About</a></li>
<li class="nav"><a href="products.html">Products</a></li>
</ul>
</div>

<!-- Titles and and information used for example -->
<div class="leftabout">
<h3>Mission</h3>
<p>Information</p>
</div>

<!-- Set so that a staff's information can be displayed when their name is clicked -->
<div class="rightabout">
<h3>Staff</h3>
<h4 onclick="viewInfo(this)">Staff Name</h4>
<p class="hide">Staff info and credentials</p>
</div>

<script type="text/JavaScript" src="companyscript.js"> </script>

</body>
100 changes: 100 additions & 0 deletions backChallenge.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import java.io.BufferedReader;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.FileReader;
import java.io.FileNotFoundException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
import java.util.StringTokenizer;
import org.json.simple.*;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;

public class backChallenge {
private static HttpURLConnection connection;
private static StringBuffer data;

public backChallenge(int[] numArray, JSONObject o) {
BufferedReader reader;
data = new StringBuffer();
try {
URL url = new URL("https://api.github.com/repos/Headstorm/Interview/contents/challenges/data?ref=master");
connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("PUT");
connection.setDoOutput(true);
connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("Accept", "application/json");
OutputStreamWriter os = new OutputStreamWriter(connection.getOutputStream());

// JSONObject jOb = new JSONObject();
//jOb.put("accept", "application/vnd.github.v3+json");
// jOb.put("path", "challenges/data/newNumbers.json");
//jOb.put("name", "JSON Data Numbers");
//jOb.put("content", o);
String content = ("{\"accept\":\"application/vnd.github.v3+json\", "
+ " \"message\": \"JSON Data Numbers\", \"path\": \"challenges/data/newNumbers.json\","
+ "\"content\": " + o);

System.out.print(content);
os.write(content);

int status = connection.getResponseCode();
if (status != 200 && status!= 201) {
System.out.println("Error: " + status);
System.exit(0);
}
}
catch (Exception e){
e.printStackTrace();
}
}

public static void main(String[] args) throws IOException {
System.out.println("Enter file name with JSON list of 500 numbers and press enter.");
Scanner in = new Scanner(System.in);
String fileName = in.next();
JSONParser parser = new JSONParser();
int[] numArray = new int[500];

try {
Object o = parser.parse(new FileReader(fileName));
JSONObject jObj = (JSONObject) o;
String numbers = jObj.get("data").toString();
StringTokenizer tokens = new StringTokenizer(numbers, "[*,\s*]*");

int count = 0;
while (tokens.hasMoreTokens() || count > 500) {
numArray[count] = (int) Integer.parseInt(tokens.nextToken());
count++;
}
if (count != 500) {
System.out.println("Error - JSON Object must contain exactly 500 numbers");
System.exit(0);
}
new backChallenge(numArray, jObj);
}
catch (FileNotFoundException fe) {
fe.printStackTrace();
System.out.println("Error - file not found. Please make sure to type in file name with extension (ie 'filename.txt'");
System.exit(0);
}
catch (ParseException pe) {
pe.printStackTrace();
System.out.println("Error - Please make sure file contains JSON with key 'data' and value as 500 numbers separated by commas");
System.exit(0);
}
catch (ClassCastException cce) {
cce.printStackTrace();
System.out.println("Error - Please make sure all elements in list are numbers only");
System.exit(0);
}
catch (Exception e) {
e.printStackTrace();
System.out.println("Error - Please try again");
System.exit(0);
}


}
}
Binary file added business.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added business2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
148 changes: 148 additions & 0 deletions companystyle.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
h2 {
text-align: left;
}
h3 {
text-align: center;
font-size: 22px;
font-family: Verdana, Arial, sans-serif
}
.header {
padding-bottom: 200px;
background-color: black;
}
#logo {
width: 15%;
padding: 10px 10px;
float: left;
clear: right;
}
#frontpage {
width: 20%;
text-align: left;
float: left;
clear: right;
color: white;
padding: 10px 10px;
font-weight: bold;
font-size: 45px;
font-family: Verdana, Arial, sans-serif;
}
#headimg {
width: 60%;
float: left;
opacity: 75%;
padding: 10px 5px;
}
#headimg:hover {
opacity: 100%;
}
.listnav {
list-style-type: none;
margin: 0;
padding: 5px 0;
}
.nav {
float: left;
text-align: center;
width: 33.33%;
background-color: #000000;
}
.nav a{
display: block;
text-decoration: none;
font-size: 18px;
font-weight: bold;
color: #ff0000;
padding-top: 5px;
height: 25px;
}
.nav a:visited {
color: #ff9999;
}
.nav a:hover {
color: #800000;
background-color: #a3a3c2;
}
.fronthead {
width: 49%;
margin-left: 5px;
margin-right: 5px;
padding-bottom: 5px;
padding-top: 5px;
}
.frontpic {
width: 49%;
margin-left: 5px;
margin-right: 5px;
padding-bottom: 5px;
padding-top: 5px;
}
#firsthead {
float: left;
}
#firstpic {
float: left;
clear: right;
}
#secondpic {
float: left;
}
#secondhead {
float: left;
clear: right;
}
#contact{
float: left;
clear: both;
width: 50%;
margin-right: 10px;
padding-bottom: 10px;
padding-top: 10px;
text-align: center;
}
.leftabout {
width: 45%;
float: left;
clear: right;
margin-left: 5px;
margin-right: 5px;
padding-bottom: 5px;
padding-top: 5px;
}
.rightabout {
width: 45%;
float: left;
margin-left: 5px;
margin-right: 5px;
padding-bottom: 5px;
padding-top: 5px;
}
.leftproduct {
width: 31%;
float: left;
clear: right;
margin-left: 5px;
padding-bottom: 5px;
padding-top: 5px;
}
.middleproduct {
width: 31%;
float: left;
clear: right;
padding-left: 5px;
padding-right: 5px;
padding-bottom: 5px;
padding-top: 5px;
}
.rightproduct {
width: 31%;
float: left;
margin-right: 5px;
padding-bottom: 5px;
padding-top: 5px;
}
.product {
display: block;
margin-left: auto;
margin-right: auto;
}
23 changes: 23 additions & 0 deletions form.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['recaptcha_response'])) {

$fname = $_POST['fname'];
$lname = $_POST['lname'];
$email = $_POST['email'];
$phonenumber = $_POST['phonenumber'];
$comments = $_POST['comments'];
$contactchoice = $_POST['contactchoice'];

$recaptcha_url = 'https://www.google.com/recaptcha/api/siteverify';
$recaptcha_secret = '6LfsrSIbAAAAAJ9R2lx7EZaX-mTMlHPQ9nYbqQKg';
$recaptcha_response = file_get_contents($recaptcha_url . 'recaptcha_secret=' . $recaptcha_secret . '&response=' . $recaptcha_response);
$response_keys = json.decode($recaptcha_response, true);
header('Content-type: application/json');

if ($response_keys["success"]) {
echo json_encode(array('success' => 'true'));
} else {
echo json_encode(array('success' => 'false'));
}

} ?>
Binary file added logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions num.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"data" : [4,81,20,43,3,48,71,51,16,47,77,83,36,37,69,72,41,73,49,49,5,57,46,63,65,3,17,98,8,22,85,0,32,47,94,35,22,24,8,31,3,46,42,63,22,49,81,43,5,35,53,34,30,50,59,68,39,97,23,35,4,89,65,16,66,84,72,62,43,88,89,24,58,44,46,98,38,43,99,99,40,0,9,14,26,12,82,9,70,17,96,49,63,25,92,51,28,38,28,3,69,77,4,51,47,35,56,61,81,37,33,63,34,94,46,39,34,82,85,71,15,36,31,81,60,66,16,39,43,15,44,7,53,51,1,20,16,73,44,2,24,30,77,98,9,66,77,6,58,75,14,52,40,96,78,31,61,30,5,1,1,89,2,82,93,43,15,24,19,18,48,99,40,69,93,8,66,18,3,85,6,58,70,9,2,54,25,70,84,76,15,53,68,96,13,83,89,68,86,76,30,73,64,46,89,8,35,43,45,69,27,5,2,49,69,80,56,75,96,43,79,19,24,83,43,58,47,15,58,86,38,29,0,20,48,79,0,80,53,17,87,45,80,70,64,27,20,85,5,97,41,88,13,71,29,15,14,27,54,52,23,20,26,49,13,2,54,18,45,36,74,61,96,5,69,41,34,1,32,36,15,69,9,21,26,99,58,30,86,77,95,11,80,54,76,66,44,10,22,29,56,67,40,18,65,57,16,60,90,62,63,98,77,97,99,6,77,84,92,41,92,76,38,9,1,90,55,30,18,95,14,90,43,92,20,9,61,65,45,1,49,57,70,23,73,72,8,66,62,69,4,8,9,2,56,3,5,17,56,14,36,18,19,62,88,54,89,79,47,69,53,2,59,95,58,24,95,51,37,5,16,49,17,61,40,26,69,65,52,84,93,75,26,12,44,99,57,64,53,96,87,15,88,16,78,16,74,5,81,16,49,93,1,30,84,71,94,72,34,95,31,6,18,96,7,16,8,16,55,42,54,30,26,15,46,38,11,62,28,88,5,3,83,63,22,15,43,5,99,99,60,33,42,67,41,74,77,61,37,10,78,55,75,7,81,80,62,72,77,29,57,79,54,9,70,85,30,20,21,80,15,38,20,48,32,43,40,40,81,67,28,42,56,23,2,43,27,15,7,32]}
Binary file added product.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading