Skip to content

Instantly share code, notes, and snippets.

View kevinhowbrook's full-sized avatar
☯️
...probably writing a test

Kevin kevinhowbrook

☯️
...probably writing a test
View GitHub Profile
@kevinhowbrook
kevinhowbrook / gridcalc.py
Last active June 2, 2018 14:01
#onmedium
def calculate_m():
# get a list of possible squared numbers, this give us the number of
# rows and columns to use for the canvas, eg 4 = 2 x 2, 6 = 3 x 3...
# Return: [] of squared numbers up to 10000 (hopefully we don't get that high!)
m = []
for i in range(1,10000):
m.append(i*i)
return(m)
def grid(n,m):
@kevinhowbrook
kevinhowbrook / example1.py
Last active June 2, 2018 14:01
An example of building up RGB values #onmedium
for i,letter in enumerate(letters):
# Only three numbers needed for RGB so use the first three values as a base
# eg: [10, 4, 21]
n = 255.0 / 26.0 # make sure we don't get a value above 255. (z = 26. 25 *10 = 260 but 26 * 9.8 = 248
if i < 3:
# add the first three values to a new list (number)
letterPosition = alphabet.index(letter) * n # *n here to force a good large number base
number.append(letterPosition)
# Use the remaining values to fine tune the first three we have so it will be a better variant
elif i >= 3 and i < 6: