Skip to content

Instantly share code, notes, and snippets.

View abustamam's full-sized avatar

Rasheed Bustamam abustamam

View GitHub Profile
{
"query": {
"allUsers": [
{
"name": "abustamam",
"email": "rasheed.bustamam@gmail.com"
}
]
}
}
query {
allUsers {
name
email
}
}
@abustamam
abustamam / app.js
Created August 23, 2016 02:32
Location class definition
var Location = function(data) {
this.name = data.name;
this.position = data.position;
this.address = data.address;
this.yelpID = data.yelpID;
this.marker = new google.maps.Marker({
map: map,
position: item.position,
animation: google.maps.Animation.DROP,
title: item.name,
// google map api //
'use strict';
var map, infoWindow;
// constructor fn to create a new google map center and zoom
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: 47.6133436, lng: -122.3460575},
zoom: 12
// 5 locations hard-coded in the model.
var locations = [
{name: 'EMP Museum', address: '325 5th Ave N, Seattle, WA 98109', location: {lat: 47.6217069, lng: -122.3485178}},
{name: 'Wing Luke Museum of the Asian Pacific American Experience', address: '719 S King St, Seattle, WA 98104', location: {lat: 47.5982614, lng: -122.3225812}},
{name: 'Burke Museum of Natural History and Culture', address: '4331 Memorial Way Northeast, Seattle, WA 98195', location: {lat: 47.66002169999999, lng: -122.3097775}},
{name: 'Living Computer Museum', address: '2245 1st Avenue South, Seattle, WA 98134', location: {lat: 47.5826413, lng: -122.3344039}},
{name: 'Frye Art Museum', address: '704 Terry Ave, Seattle, WA 98104', location: {lat: 47.6071857, lng: -122.3241234}},
{name: 'Seattle Art Museum', address: '1300 1st Ave, Seattle, WA 98101', location: {lat: 47.6073345, lng: -122.3379785}},
];
// end locations
'use strict';
var ViewModel = function() {
var self = this;
// initialize blank museums observable array
self.museums = ko.observableArray([]);
// populate the observable array with Location classes
locations.forEach(function(museum) {
self.museums.push(new Location(museum))
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Museums in Seattle - Neighborhood Map</title>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Raleway" type="text/css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
@abustamam
abustamam / app.js
Created August 21, 2016 02:52
Binding map and info window to global scope to clean up view model
// don't forget to run the callback `initMap` on google maps load:
// ``` index.html
// <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBM_kqQv8QyOFiPaFEXZN4c4GCFZmoDLfI&v=3&callback=initMap" async></script>
var map, infoWindow;
// no need for a `places` array, since it'll all be stored in
// ViewModel.placeList observable array
// var places = [];
<!DOCTYPE html>
<html>
<head>
<title>Neighborhood Map</title>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<link rel="stylesheet" href="css/main.css">
</head>
<body>
<header>
// Model data
var locationList = [
{
name: 'Sextant Coffee Roasters',
location: {lat: 37.772437, lng: -122.412901},
address: '1415 Folsom St San Francisco, CA 94103',
phone: '+14153551415',
placeId: '',
yelp: {}
},