Skip to content

Instantly share code, notes, and snippets.

View dubcdr's full-sized avatar

Devin dubcdr

  • Austin, TX
View GitHub Profile
@dubcdr
dubcdr / k-frequent.ts
Created September 30, 2021 16:57
Find K Frequent Words
const findKMostFrequentWords = (str: string, k: number): string[] => {
const words = buildWordArr(str);
const wordToCount = buildMap(words);
const countToWord = invertMap(wordToCount);
const sortedCounts = Array.from(countToWord.keys()).sort((a,b) => {
return b - a;
});
const kHighestCounts = sortedCounts.slice(0,k);
@dubcdr
dubcdr / chatbot-iframe.html
Created November 16, 2018 17:16
Walmart Chatbot Link
<html>
<head>
<script>
document.addEventListener('click', function (event) {
if (!event.target.matches('#link')) return;
event.preventDefault();
const windowOptions = 'menubar=no, toolbar=no, width=600, height=800, scrollbars=no';
const url = `https://pfedprod.walmartone.com/idp/startSSO.ping?PartnerSpId=ava-chatbotatx`
window.open(url, "ava-chatbot", windowOptions);
@dubcdr
dubcdr / app.module.ts
Last active November 13, 2018 02:37
Reactive Forms - App Module
@NgModule({
declarations: [...],
imports: [
BrowserModule,
AppRoutingModule,
/*
** Important to Include FormsModule & ReactiveFormsModule
*/
FormsModule,
ReactiveFormsModule,