Skip to content

Instantly share code, notes, and snippets.

View pyplacca's full-sized avatar
😮‍💨
Exuding awesomeness

David Placca pyplacca

😮‍💨
Exuding awesomeness
View GitHub Profile
@pyplacca
pyplacca / react-thumbnail-generator.jsx
Last active July 21, 2021 02:36
React component for generating video thumbnails
import React, {
useState,
useRef,
forwardRef,
useImperativeHandle
} from 'react'
function ThumbnailGenerator({ src, width, height }, ref) {
/*
The only required prop is the "src".
@pyplacca
pyplacca / words.js
Last active July 20, 2020 14:25
A json file of English words
words = [
"anopheles",
"uniclinal",
"sarong",
"turcoman",
"corrugator",
"self-murder",
"anacardium",
"knurly",
"pock",
@pyplacca
pyplacca / sum(evenNumbers_of_fibonacciSeries)
Created February 9, 2018 13:12
The function returns the sum of all even numbers in the Fibonacci series whose values do not exceed 'n'.
def fibEvens(n):
fibs = []
fib_evens = []
a,b = 0,1
while b < n:
a,b = b,a+b
if b < n:
fibs.append(b)
for numbers in fibs:
if numbers % 2 == 0:
@pyplacca
pyplacca / sum(multiples_of_3or5)
Created February 9, 2018 11:37
Depending on the range passed in the function, the sum of all multiples of 3 or 5 below the range will be returned
def multiples3or5(numRange):
mults3or5 = []
for naturals in range(0,numRange):
if naturals in range(3,numRange,3) or naturals in range(5,numRange,5):
mults3or5.append(naturals)
return sum(mults3or5)
@pyplacca
pyplacca / number_divisors
Created February 8, 2018 17:59
Returns all divisors of a number
def divisor():
number = int(input("Pick a number: "))
divisors = []
for i in range(1,number + 1):
if number % i == 0:
divisors.append(i)
return ("Divisors of " + str(number) + " = " + str(divisors))