diff --git a/beer-app-/Images/pexels_beer.jpg b/beer-app-/Images/pexels_beer.jpg new file mode 100644 index 0000000..a2bf1e2 Binary files /dev/null and b/beer-app-/Images/pexels_beer.jpg differ diff --git a/beer-app-/README.md b/beer-app-/README.md new file mode 100644 index 0000000..2403ae3 --- /dev/null +++ b/beer-app-/README.md @@ -0,0 +1,7 @@ +# BrewPairology (Mobile Friendly) Website App + +Discover recommendations to find the perfect brew for you based on your food choice. + +https://brewpairology.netlify.app/ + +[![Netlify Status](https://api.netlify.com/api/v1/badges/0f33ae88-5920-4298-9a2a-2b9b500e747d/deploy-status)](https://app.netlify.com/sites/brewpairology/deploys) diff --git a/beer-app-/index.html b/beer-app-/index.html new file mode 100644 index 0000000..a0f9ef3 --- /dev/null +++ b/beer-app-/index.html @@ -0,0 +1,41 @@ + + + + + + + Brew Pairology + + + + + + + + + + + + +
Brew Pairology
+
+ +
+

+ +

Lookup +

+ + +
+
+
+ + + + + + diff --git a/beer-app-/index.js b/beer-app-/index.js new file mode 100644 index 0000000..12b2cd6 --- /dev/null +++ b/beer-app-/index.js @@ -0,0 +1,46 @@ +const buttonSearch = document.getElementById('buttonSearch'); +const textSearch = document.getElementById('food'); +const resultArea = document.getElementById('result'); +let resultString = ""; + +buttonSearch.onclick = function() { + var searchTerm = textSearch.value; + + const url = `https://api.punkapi.com/v2/beers?food=${searchTerm}`; + console.log(url); + + if (!('fetch' in window)) { + console.log('Fetch API not found, try including the polyfill'); + return; + } + + //Proceeding to fetch + fetch(url) + .then(function(data) { + return data.json(); + }) + .then(function(jsonObject) { + console.log(jsonObject); + for(beer in jsonObject) { + const beerInfo = new Array(jsonObject[beer].name, jsonObject[beer].tagline,jsonObject[beer].description, + jsonObject[beer].image_url) + beerOut(beerInfo); + } + resultArea.innerHTML = resultString; + }) + .catch(function(error) { + console.log('Looks like there was a problem: \n', error); + }); +} + +function beerOut(beer) { + console.log(beer) + resultString += `
+
+
+

${beer[0]}

+

${beer[1]}

+

${beer[2]}

+
+
`; +} \ No newline at end of file diff --git a/beer-app-/node_modules/python/LICENSE.txt b/beer-app-/node_modules/python/LICENSE.txt new file mode 100644 index 0000000..53655e4 --- /dev/null +++ b/beer-app-/node_modules/python/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2011 Darren DeRidder + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/beer-app-/node_modules/python/README.md b/beer-app-/node_modules/python/README.md new file mode 100644 index 0000000..3f57ba9 --- /dev/null +++ b/beer-app-/node_modules/python/README.md @@ -0,0 +1,39 @@ +node-python +=========== + +A super-simple wrapper for NodeJS to interact programatically with the Python shell. Enables the use of Python-based tools from Node. + +[![NPM Stats](https://nodei.co/npm/python.png?downloads=true&stars=true)](https://npmjs.org/package/python) + +![NPM Downloads](https://nodei.co/npm-dl/python.png?months=9) + +Example +------- +This example starts a python child process, reads stdin for python commands, pipes them through to the python shell and runs the callback method with the resulting output. State is preserved in the shell between calls. + +```javascript +// ------ +// app.js +// ------ +var python=require('python').shell; + +// a callback to handle the response +var mycallback = function(err, data) { + if (err) { + console.error(err); + } else { + console.log("Callback function got : " + data); + } +}; + +// to test, read and execute commands from stdin +process.stdin.resume(); +process.stdin.setEncoding('utf8'); +process.stdin.on('data', function(chunk) { + python(chunk, mycallback); +}); +``` + +License +------- +MIT diff --git a/beer-app-/node_modules/python/example/app.js b/beer-app-/node_modules/python/example/app.js new file mode 100755 index 0000000..fba8b1c --- /dev/null +++ b/beer-app-/node_modules/python/example/app.js @@ -0,0 +1,19 @@ +#!/usr/bin/env node +var python = require('../lib/python').shell; +var mycallback = function(err, data) { + if (err) { + console.error(err); + } else { + process.stdout.write(data + '\n>>> '); + } +}; +process.stdout.write('Using Python from NodeJS\n>>> '); +process.stdin.resume(); +process.stdin.setEncoding('utf8'); +process.stdin.on('data', function (chunk) { + python(chunk, mycallback); +}); + +process.stdin.on('end', function() { + python('quit()'); +}); diff --git a/beer-app-/node_modules/python/lib/python.js b/beer-app-/node_modules/python/lib/python.js new file mode 100644 index 0000000..c29c2a5 --- /dev/null +++ b/beer-app-/node_modules/python/lib/python.js @@ -0,0 +1,60 @@ +var util = require('util'); +var spawn = require('child_process').spawn; +var child = spawn('python',['-u','-i']); +var cmdQueue = new Array(); + + +child.stdout.on('data', handleStdout); +child.stderr.on('data', handleStderr); +child.on('exit', handleExit); + + +function handleStdout(data) { + var datastr = data.toString('utf8'); + var finished = false; + if (datastr.match(/Command Start\n/)) { + datastr = datastr.replace(/Command Start\n/,''); + } + if (datastr.match(/Command End\n/)) { + datastr = datastr.replace(/Command End\n/,''); + finished = true; + } + if (cmdQueue.length > 0) { + cmdQueue[0].data+=datastr; + } + if (finished) { + cmd = cmdQueue.shift(); + if (cmd && cmd.command) { + if (undefined != typeof cmd.callback) { + cmd.callback(null, cmd.data); + processQueue(); + } + } + } +}; + + +function handleStderr(data) { + processQueue(); +}; + +function processQueue() { + if (cmdQueue.length > 0 && cmdQueue[0].state === 'pending') { + cmdQueue[0].state = 'processing'; + child.stdin.write(cmdQueue[0].command, encoding='utf8'); + } +}; + + +function handleExit(code) { + console.log('child process exited with code ' + code); + process.exit(); +}; + + +this.shell = function (command, callback) { + command = 'print "Command Start"; ' + command + '\nprint "Command End"'; + if (command.charAt[command.length-1]!='\n') command += '\n'; + cmdQueue.push({'command':command, 'callback':callback, 'data': '', state: 'pending'}); + processQueue(); +}; diff --git a/beer-app-/node_modules/python/package.json b/beer-app-/node_modules/python/package.json new file mode 100644 index 0000000..3694f83 --- /dev/null +++ b/beer-app-/node_modules/python/package.json @@ -0,0 +1,46 @@ +{ + "_from": "python", + "_id": "python@0.0.4", + "_inBundle": false, + "_integrity": "sha1-MJTomO8Xozqpw+lzs4SKOOR9GBg=", + "_location": "/python", + "_phantomChildren": {}, + "_requested": { + "type": "tag", + "registry": true, + "raw": "python", + "name": "python", + "escapedName": "python", + "rawSpec": "", + "saveSpec": null, + "fetchSpec": "latest" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/python/-/python-0.0.4.tgz", + "_shasum": "3094e898ef17a33aa9c3e973b3848a38e47d1818", + "_spec": "python", + "_where": "/Users/Gutierya/Documents/#100Devs/beer-app", + "author": { + "name": "Darren DeRidder" + }, + "bugs": { + "url": "https://github.com/73rhodes/node-python/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Interact with a long-running python child process", + "engines": { + "node": ">= 0.4.1" + }, + "homepage": "https://github.com/73rhodes/node-python", + "main": "./lib/python.js", + "name": "python", + "repository": { + "type": "git", + "url": "git://github.com/73rhodes/node-python.git" + }, + "version": "0.0.4" +} diff --git a/beer-app-/node_modules/python/test/python.test.js b/beer-app-/node_modules/python/test/python.test.js new file mode 100644 index 0000000..1faeda2 --- /dev/null +++ b/beer-app-/node_modules/python/test/python.test.js @@ -0,0 +1,22 @@ +var assert = require('assert'); +var python = require('../lib/python').shell; + +var runTests = function() { + // Run a couple commands in series + python('print "Hello World!"', function(err, data) { + assert.equal('Hello World!\n', data); + console.log('test 1 ok!'); + python('print "Goodbye, Cruel World!"', function (err, data) { + assert.equal('Goodbye, Cruel World!\n', data); + console.log('test 2 ok!'); + python('quit()'); + }); + }); + // Run one in parallel with the first two + python('print "Asynch"', function (err, data) { + assert.equal('Asynch\n', data); + console.log('test 3 ok!'); + }); +}; + +runTests(); diff --git a/beer-app-/package-lock.json b/beer-app-/package-lock.json new file mode 100644 index 0000000..004f4c6 --- /dev/null +++ b/beer-app-/package-lock.json @@ -0,0 +1,13 @@ +{ + "name": "beer-app", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "python": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/python/-/python-0.0.4.tgz", + "integrity": "sha1-MJTomO8Xozqpw+lzs4SKOOR9GBg=" + } + } +} diff --git a/beer-app-/package.json b/beer-app-/package.json new file mode 100644 index 0000000..7774521 --- /dev/null +++ b/beer-app-/package.json @@ -0,0 +1,14 @@ +{ + "name": "beer-app", + "version": "1.0.0", + "description": "Pairology beer app that offers recommendations for beer with food pairings.", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Yamilet G.", + "license": "ISC", + "dependencies": { + "python": "0.0.4" + } +} diff --git a/beer-app-/styles.css b/beer-app-/styles.css new file mode 100644 index 0000000..c6a6104 --- /dev/null +++ b/beer-app-/styles.css @@ -0,0 +1,62 @@ + + /****************************************** + /* BASE STYLES + /*******************************************/ + + body { + font-family: 'Bungee Shade', cursive; + font: 1rem; + } + + + /****************************************** + /* LAYOUT + /*******************************************/ + + +.center { + font-size: 3rem; +} +.container-lg { + background-color: transparent; +} + + +#food { + max-width: fit-content; +} + +#container { + margin: .313rem; +} + + + +.beer { + border: 1px solid indigo; + margin: 5px; + margin-bottom: 15px; + padding: 10px; + border-radius: 5px; + background-color: pink; + -webkit-box-shadow: 10px 13px 30px -19px rgba(0,0,0,0.5); + -webkit-moz-shadow: 10px 13px 30px -19px rgba(0,0,0,0.5); + box-shadow: 10px 13px 30px -19px rgba(0,0,0,0.5); + display: flex; + justify-content: space-between; +} + +.beerImage { + padding: 10px; + height: 20px; + width: 50px; + order: 1; +} + +.beerImage img { + width: 60px; +} + /****************************************** + /* ADDITIONAL STYLES + /*******************************************/ +