Skip to content

Instantly share code, notes, and snippets.

View angle943's full-sized avatar

Justin Kim angle943

  • Amazon
  • Seattle
  • 15:55 (UTC -07:00)
View GitHub Profile
@angle943
angle943 / app.js
Created April 4, 2020 05:26
Connect Four app.js
// DOM Elements
const allCells = document.querySelectorAll('.cell:not(.row-top)');
const topCells = document.querySelectorAll('.cell.row-top');
const resetButton = document.querySelector('.reset');
const statusSpan = document.querySelector('.status');
// columns
const column0 = [allCells[35], allCells[28], allCells[21], allCells[14], allCells[7], allCells[0], topCells[0]];
const column1 = [allCells[36], allCells[29], allCells[22], allCells[15], allCells[8], allCells[1], topCells[1]];
const column2 = [allCells[37], allCells[30], allCells[23], allCells[16], allCells[9], allCells[2], topCells[2]];
@angle943
angle943 / style.css
Created April 4, 2020 05:25
Connect Four style.css
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
align-items: center;
background: white;
display: flex;
@angle943
angle943 / index.html
Created April 4, 2020 05:25
Connect Four index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="style.css">
<title>Connect Four!</title>
</head>
@angle943
angle943 / style.css
Created March 27, 2020 03:17
Pokedex - CSS
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
display: flex;
font-family: sans-serif;
justify-content: center;
@angle943
angle943 / index.html
Last active April 24, 2022 06:23
Pokedex - HTML
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="style.css">
<title>Pokedex</title>
</head>
@angle943
angle943 / pairwise.js
Created February 9, 2020 23:11
Javascript Freecodecamp Algorithm #30: Pairwise
function pairwise(arr, arg) {
const usedDict = {};
let output = 0;
for (let i = 0; i < arr.length - 1; i++) {
if (usedDict[i]) {
continue;
}
const iVal = arr[i];
@angle943
angle943 / heaps-algorithm.js
Created February 8, 2020 10:29
Heap's Algorithm In Javascript
const getPermutations = arr => {
const output = [];
const swapInPlace = (arrToSwap, indexA, indexB) => {
const temp = arrToSwap[indexA];
arrToSwap[indexA] = arrToSwap[indexB];
arrToSwap[indexB] = temp;
};
@angle943
angle943 / inventory-update.js
Created February 3, 2020 06:09
Javascript Freecodecamp Algorithm #28: Inventory Update
function updateInventory(arr1, arr2) {
const obj1 = arr1.reduce((acc, [amt, name])=>({
...acc,
[name]: amt
}), {});
const obj2 = arr2.reduce((acc, [amt, name])=>({
...acc,
[name]: amt
}), {});
@angle943
angle943 / symmetric-difference-1.js
Created February 3, 2020 05:08
Javascript Freecodecamp Algorithm #27: Find The Symmetric Difference (N Cubed Solution)
const symOfTwo = (arr1, arr2) => {
const output = [];
for (const el of arr1) {
if (!output.includes(el) && !arr2.includes(el)) {
output.push(el);
}
}
for (const el of arr2) {
if (!output.includes(el) && !arr1.includes(el)) {
@angle943
angle943 / symmetric-difference-2.js
Created February 3, 2020 05:06
Javascript Freecodecamp Algorithm #27: Find The Symmetric Difference (N Squared Solution)
const symOfTwo = (arr1, arr2) => {
const set1 = new Set(arr1);
const set2 = new Set(arr2);
const combinedArr = [...set1, ...set2];
const elObj = {};
for (const el of combinedArr) {
if (el in elObj) {
elObj[el]++;