-
Notifications
You must be signed in to change notification settings - Fork 30
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
HW3 submission #24
Open
SagariDatta
wants to merge
2
commits into
MUSA611-CPLN692-spring2019:master
Choose a base branch
from
SagariDatta:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
HW3 submission #24
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
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,99 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<!--stylesheet imports--> | ||
<link rel="stylesheet" href="leaflet.css" /> | ||
</head> | ||
<body> | ||
|
||
<!--left panel--> | ||
<div style="position: absolute; left: 0px; width: 400px; top: 0; bottom: 0;"></div> | ||
<!--map--> | ||
<div id="map" style="position: absolute; right: 0; left: 400px; top: 0; bottom: 0;"></div> | ||
|
||
<!--javascript imports--> | ||
<script src="leaflet.js"></script> | ||
|
||
<script> | ||
|
||
/* ===================== | ||
|
||
# Lab 1, Part 1 — Array Access | ||
|
||
## Introduction | ||
|
||
Refactor your week 1 homework assignment to leverage some of the Javascript | ||
functionality we have been learning about. We will start by improving the | ||
way we store data and the amount of times we call the L.marker method. | ||
|
||
## Task 1: Data Storage | ||
|
||
Let's consider a marker for a single restaurant point location. We could | ||
store information about that marker as an array | ||
([element1, element2, element3...]). Your point location array should | ||
contain the following three elements in this order: 1. lat, 2. lng, 3. label. | ||
|
||
Create an array of arrays (an array that contains multiple arrays) to | ||
represent every restaurant in your restaurant data. Save this as variable | ||
"restaurantData". | ||
|
||
## Task 2: Process Data | ||
|
||
Create a marker for each element in "restaurantData". Your final code should | ||
only include "L.marker" one time. | ||
|
||
## Task 3: Add Two Additional Markers | ||
|
||
Add two additional restaurants to your data. You should only need to modify | ||
"restaurantData" to do this. Confirm that these new markers are added to | ||
your application. | ||
|
||
## Task 4: Add Popups to Markers | ||
|
||
Add popups to your markers. The popup should contain the label for your | ||
restaurant. Refer to the Leaflet documentation for instructions on adding | ||
a popup: http://leafletjs.com/reference.html#popup | ||
|
||
===================== */ | ||
|
||
var map = L.map('map', { | ||
center: [39.9522, -75.1639], | ||
zoom: 14 | ||
}); | ||
|
||
var Stamen_TonerLite = L.tileLayer('http://stamen-tiles-{s}.a.ssl.fastly.net/toner-lite/{z}/{x}/{y}.{ext}', { | ||
attribution: 'Map tiles by <a href="http://stamen.com">Stamen Design</a>, <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a> — Map data © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>', | ||
subdomains: 'abcd', | ||
minZoom: 0, | ||
maxZoom: 20, | ||
ext: 'png' | ||
}).addTo(map); | ||
|
||
/* ===================== | ||
|
||
Start code | ||
|
||
===================== */ | ||
|
||
//Create arrays | ||
restaurantData = [ [39.955032, -75.202487, "Han Dynasty"], [39.956887, -75.196624, "U-Town"], [39.953096, -75.192071, "Food Mart"], [39.957512, -75.191771, "Blaze Pizza"], [39.953861, -75.187737, "Shake Shack"]] | ||
|
||
//Add marker | ||
//console.log(restaurantData.length); //checking array length | ||
for (var i=0; i < restaurantData.length; i = i+1) { | ||
//checking array values | ||
//console.log(restaurantData[i]); | ||
//console.log(restaurantData[i][i]); | ||
L.marker([restaurantData[i][0], restaurantData[i][1]]).addTo(map).bindPopup(data1[i][2]).openPopup(); | ||
} | ||
|
||
|
||
/* ===================== | ||
|
||
End code | ||
|
||
===================== */ | ||
|
||
</script> | ||
</body> | ||
</html> |
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,53 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
</head> | ||
<body> | ||
|
||
<script> | ||
|
||
/* ===================== | ||
|
||
# Lab 1, Part 2 — FizzBuzz | ||
|
||
## Introduction | ||
|
||
Write a program that uses console.log to print the numbers from 1 to 100. | ||
For multiples of three, print "Fizz" instead of the number. For multiples | ||
of five, print "Buzz" instead of the number. For numbers which are multiples | ||
of both three and five, print "FizzBuzz". | ||
|
||
Believe it or not, this is a common programming challenge in job interviews. | ||
|
||
===================== */ | ||
|
||
/* ===================== | ||
|
||
Start code | ||
|
||
===================== */ | ||
|
||
for (var i = 0; i < 101; i++){ | ||
if ((i % 3 == 0) && (i % 5 == 0)) { | ||
console.log(i); | ||
console.log("FrizzBuzz") | ||
} | ||
else if (i% 3 == 0) { | ||
console.log(i); | ||
console.log("Frizz"); | ||
} | ||
else if (i % 5 == 0) { | ||
console.log(i); | ||
console.log("Buzz"); | ||
} | ||
} | ||
|
||
/* ===================== | ||
|
||
End code | ||
|
||
===================== */ | ||
|
||
</script> | ||
</body> | ||
</html> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data1
is not defined and it's throwing an error. When set torestaurantData
it works.