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
import com.jsoniter.JsonIterator; | |
import com.jsoniter.any.Any; | |
import com.oc.projectone.dataminer.model.Person; | |
import org.springframework.stereotype.Service; | |
import javax.annotation.PostConstruct; | |
import java.io.IOException; | |
import java.nio.file.Files; | |
import java.nio.file.Paths; |
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
from bs4 import BeautifulSoup | |
import requests | |
import pandas as pd | |
def process_single_book(website): | |
# Get Request and Status Code | |
response = requests.get(website, verify=False) | |
# print(response.status_code) |
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
function botGreeting() { | |
return "Hello, I'm the Getaway Bot! I want to help you find your dream destination. You can ask me about our current offers, payment, or contact info. Or type 'help'."; | |
} | |
function botResponse(message) { | |
return ( | |
"I'm not sure I understood your message: '" + | |
message + | |
"'. Type 'help' to see more options." | |
); |
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
// v1 | |
// write a function that says hello from the bot, to be called when the chat starts | |
function botGreeting() { | |
return "Hello, I'm the Getaway Bot! I want to help you find your dream destination. You can ask me about our current offers, payment, or contact info. Or type 'help'."; | |
} | |
// v2 | |
// When the bot doesn't understand, we still want the bot to give a response to the user. Write a function `botResponse` that explains that the bot didn't understand. It should say "I'm not sure I understood your message: '[message]'. Type 'help' to see more options." | |
function botResponse(message) { | |
return ( |
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
const faker = require('faker'); | |
function plantGenerator() { | |
let randomName = faker.name.findName(); | |
let randomColor = faker.color(); | |
return { | |
name: randomName, | |
color: randomColor | |
}; | |
} |
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
function getBorrowersForBook(book, accounts) { | |
let result = []; | |
let borrowArray = book.borrows; | |
borrowArray.forEach(borrow=>{ | |
let account = accounts.find(acc => acc.id === borrow.id); | |
let obj = account; | |
obj['returned'] = borrow.returned; | |
result.push(obj); | |
}) | |
console.log(result); |
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
function bulkDelete(ids) { | |
const promises = ids.map((id) => { | |
const url = `${BASE_URL}/constellations/${id}`; | |
return axios.delete(url).then((data)=>{ | |
console.log(data); | |
return {id}; | |
}) | |
}); | |
return Promise.all(promises); | |
} |
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
const { welcome, goodbye, tell } = require("../utils/fortune-teller"); | |
function getFortune(question) { | |
tell(question).then(msg => { | |
console.log(`Your question was: ${question}`); | |
console.log(`Your fortune is: ${msg}`)}) | |
.catch(err => console.log('There was an error: A question is required...')); | |
} | |
function fullSession(question) { |
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
function allCandyOrders(inventory) { | |
let result = {}; | |
for (let i=0; i<inventory.length; i++) { | |
if (inventory[i].inStock < inventory[i].weeklyAverage) { | |
result[inventory[i].candy]= inventory[i].weeklyAverage * 2; | |
} else { | |
result[inventory[i].candy] = 0; | |
} | |
} | |
return result; |
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
function getBooksPossessedByAccount(account, books, authors) { | |
//Initialze a return array | |
let booksPossessed=[]; | |
//check for the account id in the borrows arrays | |
books.forEach(book => { | |
let borrowArray = book.borrows; | |
if (borrowArray.find(borrow => borrow.id === account.id && borrow.returned === false)) { | |
booksPossessed.push(book); | |
} | |
}) |
NewerOlder