Skip to content

Instantly share code, notes, and snippets.

View gregdevs's full-sized avatar

Greg gregdevs

View GitHub Profile
function checkIfTwoNumbersAddUp(list, x) {
let currentElement;
let currentPos = 0;
let next = 0;
let hasPair = false;
const loopThrough = () => {
if (list.length - 1 === currentPos) {
return;
}
@gregdevs
gregdevs / Refactored NBC thoughts
Created December 5, 2019 14:08
Refactored NBC thoughts
//******REFACTORED CODE*****///
Going off ofmy memory of the test but I wanted to point out some improvements I would have made
// Instead of iterating and attaching event listeners on each path element, I would've wanted to go back and just have the click event attached to the parent and grab the target elem path from that instead.
const svgelem = document.querySelector('svg');
svgelem.addEventListener('click', function(e){
const state = e.target.getAttribute('data-state'),
votes = e.target.getAttribute('data-votes'),
//Probably a Naive solution
const sortedArr = [1,2,3,7,9,15,56,76,78];
function findElem(arr, n){
const firstHalf = arr.slice(0, arr.length / 2),
secondHalf = arr.slice(arr.length / 2);
let arrToPass;
if (arr.length === 1 && arr[0] !== n){
@gregdevs
gregdevs / index.html
Last active September 12, 2016 04:20
NY State with Counties Clipped
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.outline {
fill: none;
stroke: #000;
stroke-width: 1.5px;
}
.feature {