Skip to content

Instantly share code, notes, and snippets.

@adyngom
adyngom / blog.md
Last active Mar 6, 2022
angular worksapce article
View blog.md

Angular - Grouping Applications & Libraries Under A Single Workspace

As of Angular 9, the Angular CLI has a new feature called a workspace. If you have ever thought about segmenting a project into muliple smaller applications, and at the same time staying DRY with reusable libraries, data access tools and a sane way to keep all of it under the same version for easy updates then you are in for a treat with the new Angular Workspace feature.

In this article we will look at how straightforward it is to get started with an Angular workspace and more importantly look at a few use cases that make this feature a great fit for your project.

@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>