Skip to content

Instantly share code, notes, and snippets.

View atembamanu's full-sized avatar
🎯
Focusing

Emmanuel Atemba atembamanu

🎯
Focusing
  • betahood Technologies
  • @kenya
View GitHub Profile
@atembamanu
atembamanu / duplicates.js
Last active August 19, 2020 17:51
Count duplicates within an Array of Objects, return Unique Entries
const data = [
{ a: { animal: "dog" } },
{ a: { animal: "dog" } },
{ b: { animal: "dog" } },
{ a: { animal: "dog" } },
{ b: { animal: "puppy" } },
{ c: { animal: "dog" } },
];
function countDuplicates(originalArray) {
@atembamanu
atembamanu / duplicates2.js
Created August 19, 2020 19:19
Duplicates in JS Array
const data = [
{ name: "Dev User", department: "ICT", taskPercentCompleted: 100 },
{ name: "John Doe", department: "Finance", taskPercentCompleted: 100 },
{ name: "Jane Doe", department: "Human Resource", taskPercentCompleted: 10 },
{ name: "Jane Doe", department: "Human Resource", taskPercentCompleted: 100 },
{ name: "Dev User", department: "ICT", taskPercentCompleted: 90 },
{ name: "John Doe", department: "ICT", taskPercentCompleted: 100 },
{ name: "John Doe", department: "ICT", taskPercentCompleted: 100 },
];
function uploadStatus() {
$("#invoiceModal").modal("hide");
var doc = new jsPDF();
//From Javascript
var finalY = doc.lastAutoTable.finalY || 10;
doc.text("Millestone Payment Invoice", 14, finalY + 15);
doc.autoTable({
startY: finalY + 20,
head: [["Millestone", "Amount", "Date uploaded", "Uploaded by", "Status"]],