Skip to content

Instantly share code, notes, and snippets.

View pbrandiezs's full-sized avatar

Perry Brandiezs pbrandiezs

View GitHub Profile
@pbrandiezs
pbrandiezs / AVeryBigSum.js
Created April 3, 2022 04:28
A Very Big Sum
'use strict';
const fs = require('fs');
process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
@pbrandiezs
pbrandiezs / simpleArraySum.js
Created April 1, 2022 15:55
Simple array sum
function simpleArraySum(ar) {
let sum = 0;
for (let i=0; i < (ar.length); i++) {
sum = sum + ar[i];
}
return sum;
}
@pbrandiezs
pbrandiezs / MathChallenge.js
Created March 30, 2022 20:14
Math Challenge
function MathChallenge(num) {
// code goes here
var numstr;
var numdigits = [];
var operatorsNeeded;
var combinations;
var combinationsList = [];
var evalString = "";
var operatorString = "";
var bestMatchStr = "not possible";
import React, { useState } from 'react';
import ReactDOM from 'react-dom';
//
// To reviewer: Note I have not worked with react before. I have submitted what I
// have completed to move forward with the exercise. It looks like I'm stuck on
// passing the data between the siblings. Thanks for reviewing.
//
const style = {
@pbrandiezs
pbrandiezs / ArrayChallenge
Created March 29, 2022 15:44
Find largest gap in a list of appointments
function ArrayChallenge(strArr) {
// code goes here
let appointmentArray = [];
let isStartPM = Boolean;
let isEndPM = Boolean;
let appointmentArrayMinutes = [];
let largestGapMinutes = 0; // Initialize to 0 so overlapping appointments will 0 minutes gap.
let start;
let end;
@pbrandiezs
pbrandiezs / parseHTML.js
Last active June 11, 2021 16:48
This program will count the number of href's for a list of websites specified on the command line. Example: node parseHTML.js https://wikipedia.com https://perry-brandiezs.com
// This program will count the number of href's for a list of websites
// specified on the command line.
//
// Example:
// node parseHTML.js https://wikipedia.com https://perry-brandiezs.com
// https://wikipedia.com 318
// https://perry-brandiezs.com 6
const request = require('request');
@pbrandiezs
pbrandiezs / countIt.kt
Created June 10, 2021 20:16
Count the number of hrefs in a list of url's provided as command line arguments
import java.net.URL
import org.apache.commons.lang3.StringUtils
fun main(args: Array<String>) {
args.forEach {
// val contents = URL("https://www.wikipedia.com").readText()
val contents = URL(it).readText()
val hrefCount = StringUtils.countMatches(contents, "href")
println("$it $hrefCount")
}
.wrapper {
height: 100vh;
/*This part is important for centering*/
display: flex;
align-items: center;
justify-content: center;
}
.typing-demo {
width: 22ch;
const palindrome = str => {
str = str.toLowerCase()
return(str === str.split('').reverse().join(''))
}
palindrome("Kayak");
const fibonacci = num => {
if(num < 2) {
return num
}
return fibonacci(num - 1) + fibonacci(num -2)
}
console.log(fibonacci(5))