Skip to content

Instantly share code, notes, and snippets.

Ady Ngom adyngom

Block or report user

Report or block adyngom

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@adyngom
adyngom / js-alpharetta-vm.js
Created Jul 1, 2019
Solution to vending machine challenge - JavaScript Alpharetta June 2019
View js-alpharetta-vm.js
const VM = function(inventory) {
var drinks = inventory || null;
if (!drinks) {
throw new Error("No inventory: Cannot add a new VM");
}
const drinksKeys = Object.keys(drinks);
var sale = function(pid) {
@adyngom
adyngom / js-alpharetta-rolls-of-coins.js
Created Jul 1, 2019
Solution to rolls of coins workshop - JavaScript Alpharetta June 2019
View js-alpharetta-rolls-of-coins.js
const coinsJar = [5, 10, 10, 25, 25, 25, 10, 5, 1, 1, 1, 25, 25];
// [...coinsJar].forEach
const coinRolls = { "1": 2, "5": 2, "10": 2, "25": 2 };
const coinsLabels = {
"1": "Pennies",
"5": "Nickels",
"10": "Dimes",
"25": "Quarters"
};
@adyngom
adyngom / max-difference.js
Created Jun 13, 2019
Max difference in a set of numbers
View max-difference.js
const nums = [2, 4, 7, 5, 13, 11, 9, 1, 6, 2];
console.log(getMaxDifference(nums));
function getMaxDifference(arr) {
let max = arr[0], min = arr[0];
[...arr].forEach(n => {
if(n > max) max = n;
if(n < min) min = n;
});
@adyngom
adyngom / longest-subsequence.js
Last active Jun 13, 2019
longest subsequence between two strings
View longest-subsequence.js
/*
Given two strings s1 and s2, return the longest common subsequence of s1 and s2
(with longest common subsequence defined as the longest sequence of characters
such that all of them appear in both of the strings, possibly with other characters in between)
'ABAZDC' 'BACBAD' => ABAD
'AGGTAB' 'GXTXAYB' => GTAB
'aaaa' 'aa' => aa
*/
console.log(getLongestSub('ABAZDC','BACBAD'));
View css-off-canvas-markup-5.html
<section>
<label for="offcanvas" class="biglabel"></label>
<!--- section content --->
</section>
View css-off-canvas-markup-4.html
<div class="container">
<div class="row">
<label for="offcanvas" class="toggler">
<span class="navicon"></span>
</label>
</div>
</div>
View css-off-canvas-markup-3.html
<input type="checkbox" id="offcanvas" class="toggle" />
<div class="wrapper">
<!--- wrapper content here --->
</div>
View css-off-canvas-markup-2.html
<section>
<div class="container">
<div class="row">
<h2>Lorem ipsum dolor sit amet.</h2>
<p>Lorem ipsum......</p>
</div>
<!--- add as many rows needed --->
</div>
</section>
View css-off-canvas-markup-1.html
<div class="wrapper">
<aside>
<nav>
<ul>
<li>nav_1</li>
<li>nav_2</li>
<li>nav_3</li>
<li>nav_4</li>
<li>nav_5</li>
</ul>
@adyngom
adyngom / rolls.js
Created Jun 1, 2019
exercise solution for the rolls challenge
View rolls.js
import { coinsJar } from './oneKCoins';
import { displayRollsMessage, getQuotientRemainder, groupBy } from './Utils';
const coinRolls = { "1": 50, "5": 40, "10": 50, "25": 40 };
const coinLabels = {
"1": "Pennies",
"5": "Nickels",
"10": "Dimes",
"25": "Quarters"
};
You can’t perform that action at this time.