Skip to content

Instantly share code, notes, and snippets.

View kayslay's full-sized avatar
🎯
Focusing

Badewa Kayode kayslay

🎯
Focusing
View GitHub Profile
@kayslay
kayslay / MergeSort.go
Created September 29, 2017 16:19
merge sort using Golang
package main
import (
"fmt"
)
var (
list []int = []int{838, 23, 83, 64, 83, 23, 63, 90, 50, 20, 20, 4, 30, 5, 2, 50, 190, 19, 3, 70, 21, 3, 20, 28, 93, 39, 838, 23, 83, 64, 83, 23, 63, 90, 50, 20}
)
@kayslay
kayslay / crawl.js
Last active August 15, 2018 12:44
crawl.js for Build a CLI to crawl a web page with web-crawljs article
#!/usr/bin/env node
/**
* Created by kayslay on 5/31/17.
*/
const crawler = require('web-crawljs');
const program = require('commander');
//commander configuration
function list(val) {
"use strict";
@kayslay
kayslay / wiki.js
Last active September 21, 2017 07:26
wiki.js for Build a CLI to crawl a web page with web-crawljs article
/**
* Created by kayslay on 6/3/17.
*/
const mongoose = require('mongoose');
const dbConfig = require('../config/db');
//mongoose configs
const Schema = mongoose.Schema;
//creating a schema for the extracted data
const wikiSchema = new Schema({
title: String,
@kayslay
kayslay / db.js
Created September 20, 2017 21:36
db.js file for Build a CLI to crawl a web page with web-crawljs article.
/**
* Created by kayslay on 6/3/17.
*/
module.exports = {
dbName: "crawl",
dbHost: "localhost",
};
@kayslay
kayslay / multiples.js
Last active September 20, 2017 22:47
Calculates the sum of all multiples of numbers in an array between a limit
/**
* @description removes the multiples in the array
* @param arr
* @returns {Number}
*/
function notMultiples(arr) {
arr = arr.sort((a, b) => a - b);
return arr.reduce((notMul, num) => {
if (notMul.length) {
if ((notMul.some(div => (num % div === 0)))) {