Skip to content

Instantly share code, notes, and snippets.

<!-- component -->
<!-- Add the variant -->
<!-- variants: {
extend: {
translate: ['group-hover'],
}
}, -->
<!-- Soon review at https://moviedate.netlify.app/ -->
{"name":"ady-on-vscode","settings":"{\"settings\":\"{\\n \\\"workbench.colorTheme\\\": \\\"Atom One Dark\\\",\\n \\\"editor.inlineSuggest.enabled\\\": true,\\n \\\"editor.minimap.enabled\\\": false,\\n \\\"editor.accessibilitySupport\\\": \\\"on\\\",\\n \\\"prettier.printWidth\\\": 99999,\\n \\\"editor.wordWrap\\\": \\\"wordWrapColumn\\\",\\n \\\"editor.wordWrapColumn\\\": 100,\\n \\\"editor.formatOnSave\\\": true,\\n \\\"breadcrumbs.enabled\\\": false,\\n \\\"editor.renderControlCharacters\\\": false,\\n \\\"editor.wrappingIndent\\\": \\\"deepIndent\\\",\\n \\\"editor.mouseWheelZoom\\\": true,\\n \\\"gitlens.codeLens.authors.enabled\\\": false,\\n \\\"gitlens.codeLens.enabled\\\": false,\\n \\\"editor.cursorBlinking\\\": \\\"solid\\\",\\n \\\"audioCues.chatResponsePending\\\": \\\"off\\\",\\n \\\"audioCues.diffLineDeleted\\\": \\\"off\\\",\\n \\\"audioCues.diffLineInserted\\\": \\\"off\\\",\\n \\\"audioCues.diffLineModified\\\": \\\"off\\\",\\n \\\"
/***
Suppose we have some input data describing a graph of relationships between parents and children over multiple generations. The data is formatted as a list of (parent, child) pairs, where each individual is assigned a unique integer identifier.
For example, in this diagram, 3 is a child of 1 and 2, and 5 is a child of 4:
1 2 4
\ / / \
3 5 8
\ / \ \
6 7 9
/**
* Couple of possible solutions to the Sock Merchant challenge on Hacker Rank
* https://www.hackerrank.com/challenges/sock-merchant/problem
**/
// Solution 1
// Video tutorial can be viewed: https://youtu.be/DRp6naqL5uc
function sortAndCount( n, arr ) {
let sorted = arr.sort( (a,b) => a - b);
let pairs = 0;
@adyngom
adyngom / angular-14-defaults-schematics.ts
Created October 3, 2022 14:38
My default generators config on new Angular projects version 14 and up
"schematics": {
"@schematics/angular:application": {
"strict": true
},
"@schematics/angular:component": {
"standalone": true,
"inlineStyle": true,
"inlineTemplate": true,
"changeDetection": "OnPush"
},
@adyngom
adyngom / blog.md
Last active March 6, 2022 19:00
angular worksapce article

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 / eltonuikit.html
Last active February 13, 2020 09:27
Code for the CSS Grid Quick Overview Tutorial
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Elton ui Kit</title>
<style>
@import 'https://fonts.googleapis.com/css?family=Comfortaa:300,700|Bungee+Shade|Josefin+Sans:400';
html {
background-color: #eee;
@adyngom
adyngom / js-alpharetta-vm.js
Created July 1, 2019 21:11
Solution to vending machine challenge - JavaScript Alpharetta June 2019
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 July 1, 2019 21:09
Solution to rolls of coins workshop - JavaScript Alpharetta June 2019
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 / longest-subsequence.js
Last active June 13, 2019 04:23
longest subsequence between two strings
/*
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'));