This is based off of the tutorial found here:https://www.youtube.com/watch?v=rXuHGLzSmSE&list=WL&index=11&t=35s
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
async function convertFileToString(filepath) { | |
return await fetch(filepath) | |
.then((response) => { | |
return response.text(); | |
}) | |
.then((data) => { | |
return data; | |
}); | |
} |
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 random import randint | |
import re | |
def player_win_outcome(player_value,computer_value,): | |
print("you win!",player_value, "beats", computer_value, "!") | |
def player_loss_outcome(player_value,computer_value,): | |
print("you lose!",player_value, "loses to", computer_value, "!") | |
def tie(): |
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
/* | |
So these are the things that jumped out to me when it comes to using lesscss. | |
Obvoiusly there are others, but these features are reason enough for me to want to use less. | |
Please check them out at http://lesscss.org/ | |
If you want to see it running simply clone this repo https://github.com/bmansk8/learning-Less | |
My blogpost about this https://www.barronvbrock.net/blog | |
*/ | |
@color: red; | |
@selector: h1; |
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 pizzas from '../data.json'; | |
test('pizza data is correct ', () => { | |
expect(pizzas).toMatchSnapshot(); | |
expect(pizzas).toHaveLength(4); | |
expect(pizzas.map(pizza => pizza.name)).toEqual([ | |
'Chicago Pizza', | |
'Neapolitan Pizza', | |
'New York Pizza', | |
'Sicilian Pizza' |
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
//if you use vs code | |
//node . starts app | |
//ctrl c closes bot | |
//ctrl ` opens console | |
//make sure to install node | |
var configObj = { | |
quotes: [ | |
"put", | |
"your", |
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
// Create an array of objects which hold the denominations and their values | |
var denom = [ | |
{ name: 'ONE HUNDRED', val: 100.00}, | |
{ name: 'TWENTY', val: 20.00}, | |
{ name: 'TEN', val: 10.00}, | |
{ name: 'FIVE', val: 5.00}, | |
{ name: 'ONE', val: 1.00}, | |
{ name: 'QUARTER', val: 0.25}, | |
{ name: 'DIME', val: 0.10}, | |
{ name: 'NICKEL', val: 0.05}, |
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 telephoneCheck(str) { | |
// Good luck! | |
var regex = /^(1\s?)?(\(\d{3}\)|\d{3})[\s\-]?\d{3}[\s\-]?\d{4}$/; | |
return regex.test(str); | |
} | |
telephoneCheck("555-555-5555"); |
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 rot13(str) { // LBH QVQ VG! | |
var codeArr = str.split(""); | |
var decodedArr=[]; | |
var alphabet=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","A","B","C","D","E","F","G","H","I","J","K","L","M"]; | |
for(var i=0;i<codeArr.length;i++){ | |
if(alphabet.indexOf(codeArr[i])===-1){ | |
decodedArr.push(codeArr[i]); |
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 convertToRoman(num) { | |
var roman=""; | |
var romanNumeral=['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I']; | |
var numbers=[1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]; | |
for(var i=0;i<numbers.length;i++){ | |
while(num>=numbers[i]){ | |
roman = roman + romanNumeral[i]; | |
num = num - numbers[i]; | |
} |
NewerOlder