This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static int binarySearch (int values[], int target) { | |
int left = 0; | |
int mid = 0; | |
int right = values.length - 1; | |
while (left <= right) { | |
mid = (left + right) / 2; | |
if (target == values[mid]) | |
return mid; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"title": "An Introduction to Ruby Hashes", | |
"url": "https://towardsdatascience.com/an-introduction-to-ruby-hash-1c1c4b2dd905" | |
} | |
vs. | |
{ | |
"title": "An Introduction to Ruby Hashes", | |
"link": "https://towardsdatascience.com/an-introduction-to-ruby-hash-1c1c4b2dd905", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
posts = [] | |
Array.prototype.forEach.call(document.getElementsByClassName("nd rk rd x"), function(post) { | |
postObj = {}; | |
postObj.title = post.getElementsByTagName("a")[0].innerText; | |
postObj.link = post.getElementsByTagName("a")[0].href; | |
postObj.pubDate = post.getElementsByClassName("dv")[1].innerText; | |
posts.unshift(postObj); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import re | |
import sys | |
import json | |
import pathlib | |
import requests | |
def compare_data(oldData, newData): | |
data = [] | |
last_pub_date = oldData[-1]['pubDate'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static boolean isPrime(int number) { | |
if (number < 2) | |
return false; | |
if (number == 2 || number == 3) | |
return true; | |
if(number % 2 == 0 || number % 3 == 0) | |
return false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static boolean isPrime(int number) { | |
if (number < 2) | |
return false; | |
if (number == 2) | |
return true; | |
if(number % 2 == 0) | |
return false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static boolean isPrime(int number) { | |
if (number < 2) | |
return false; | |
if (number == 2) | |
return true; | |
if(number % 2 == 0) | |
return false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static boolean isPrime(int number) { | |
int factorCount = 0; | |
for (int i = 1; i <= number; i++) { | |
if (number % i == 0) | |
factorCount++; | |
} | |
return factorCount == 2 ? true : false; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"title": "A Beginner\u2019s Guide To Ruby", | |
"url": "https://medium.com/swlh/a-beginners-guide-to-ruby-810f230c53da" | |
}, | |
{ | |
"title": "How to Mount a Directory Inside a Docker Container", | |
"url": "https://towardsdatascience.com/how-to-mount-a-directory-inside-a-docker-container-4cee379c298b" | |
}, | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import re | |
import sys | |
import json | |
import pathlib | |
import requests | |
import fuzzywuzzy | |
from fuzzywuzzy import fuzz | |
from fuzzywuzzy import process |