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
# Run `pip3 install beautifulsoup4` to install beautiful soup 4 | |
# Run `pip3 install selenium` to install selenium | |
# Run `pip3 install webdriver-manager` to install webdriver-manager | |
# Run `brew cask install chromedriver` to install chromedriver | |
# to run this script, run `python3 scrape.py` from this folder | |
from bs4 import BeautifulSoup | |
from selenium import webdriver |
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
var library = { | |
tracks: { t01: { id: "t01", | |
name: "Code Monkey", | |
artist: "Jonathan Coulton", | |
album: "Thing a Week Three" }, | |
t02: { id: "t02", | |
name: "Model View Controller", | |
artist: "James Dempsey", | |
album: "WWDC 2003"}, | |
t03: { id: "t03", |
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
var date = process.argv[2]; | |
if (!date) { | |
console.log("Please provide a date in the format YYYY/MM/DD"); | |
} else { | |
calculateDayInYear(date); | |
} | |
function calculateDayInYear(date) { | |
var splitDate = date.split('/'); |
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
var date = process.argv[2]; | |
if (!date) { | |
console.log("Please provide a date in the format YYYY/MM/DD"); | |
} else { | |
calculateDayInYear(date); | |
} | |
function calculateDayInYear(date) { | |
var splitDate = date.split('/'); |
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 printInFrame(list) { | |
var list = list.split(' '); | |
var longest = longestStr(list).length; | |
var border = repeat('*', longest + 2); | |
console.log(border); | |
for (var word of list) { | |
console.log('* ' + word + repeat(' ', longest - word.length - 1) + '*'); | |
} | |
console.log(border); |
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 isPalindrome(str) { | |
str = str.split(" ").join("").toLowerCase(); | |
var mid = Math.floor(str.length / 2); | |
var last = str.length - 1; | |
for (var i = 0; i <= mid; i++) { | |
// console.log(">>>>" + str[i] + " " + str[last - i]); | |
if (str[i] !== str[last - i]) { | |
return false; | |
} |
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 average(list) { | |
var sum = 0; | |
for (var num of list) { | |
sum += num; | |
} | |
return sum / list.length; | |
} |
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
var numOfDice = process.argv.slice(2); | |
function rollDice(diceNumber) { | |
var diceRolls = []; | |
for (var i = 0; i < diceNumber; i++) { | |
var dice = Math.floor(Math.random() * (6 - 1 + 1) + 1) | |
diceRolls.push(dice); | |
} |
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 backwards(word) { | |
var backwardsWord = ''; | |
for (var i = word[0].length - 1; i >= 0; i--) | |
backwardsWord += word[0][i]; | |
return backwardsWord; |