Skip to content

Instantly share code, notes, and snippets.

Avatar

Shaun Pritchard shaungt1

View GitHub Profile
View scrape_recipe
def scrape_recipe(br, year, idnumber):
#This is called when user wants to scrape for specific recipe site
#Try functions were used to prevent any one element from stopping the operation
#recipe title
try:
rtitle = br.find_element_by_tag_name('h1').text
except:
rtitle = 'NA'
View top20list
br = webdriver.Firefox() #open firefox
br.get('https://www.allrecipes.com/recipes/'+str(yearurls[i]))
###ID number for year, example 1997 has ID of 14486
html_list = br.find_element_by_id("grid")
urls = html_list.find_elements(By.CLASS_NAME, "favorite")
#All top 20 recipes have hearts associated with them. Inside
#the heart contains the unique ID number for the given recipe
for i, e in enumerate(urls):
@shaungt1
shaungt1 / circle_detection.py
Created Dec 4, 2018 — forked from martinsik/circle_detection.py
Circle detection with OpenCV 3.0
View circle_detection.py
import cv2
import time
import math
import numpy as np
capture = cv2.VideoCapture(0)
print capture.get(cv2.CAP_PROP_FPS)
t = 100
w = 640.0
@shaungt1
shaungt1 / goldbach_recursion.js
Created Apr 27, 2018 — forked from ihercowitz/goldbach_recursion.js
Goldbach's conjecture in JavaScript - using Recursion
View goldbach_recursion.js
/* Goldbach's conjecture in JavaScript - using Recursion
*
* author: Igor Hercowitz
*/
function isPrime(n) {
if (n % 2 === 0) return false;
var sqrtn = Math.sqrt(n)+1;