This file contains 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
// Returns a random DNA base | |
const returnRandBase = () => { | |
const dnaBases = ['A', 'T', 'C', 'G']; | |
return dnaBases[Math.floor(Math.random() * 4)]; | |
}; | |
// Returns a random single stand of DNA containing 15 bases | |
const mockUpStrand = () => { | |
const newStrand = []; | |
for (let i = 0; i < 15; i++) { |
This file contains 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
// Codecademy Credit Card Number exercise by Eduardo Aire Torres | |
// All valid credit card numbers | |
const valid1 = [4, 5, 3, 9, 6, 7, 7, 9, 0, 8, 0, 1, 6, 8, 0, 8]; | |
const valid2 = [5, 5, 3, 5, 7, 6, 6, 7, 6, 8, 7, 5, 1, 4, 3, 9]; | |
const valid3 = [3, 7, 1, 6, 1, 2, 0, 1, 9, 9, 8, 5, 2, 3, 6]; | |
const valid4 = [6, 0, 1, 1, 1, 4, 4, 3, 4, 0, 6, 8, 2, 9, 0, 5]; | |
const valid5 = [4, 5, 3, 9, 4, 0, 4, 9, 6, 7, 8, 6, 9, 6, 6, 6]; | |
// All invalid credit card numbers |
This file contains 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
# Functions | |
def hex2rgb(hexColor): # Transforms a Hex color to its DrawBot RGB value (0 to 1 basis) | |
offset = 1 if hexColor.startswith('#') else 0 | |
r = int(hexColor[offset:offset+2], 16) | |
g = int(hexColor[offset+2:offset+4], 16) | |
b = int(hexColor[offset+4:], 16) | |
return r/255, g/255, b/255 | |
def lerp(minVal, maxVal, factor): # Linear interpolation | |
return minVal + (maxVal - minVal) * factor |
This file contains 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
# This gist is intended to be used with the DrawBot app to test your Variable Fonts in an easy way | |
x, y = 1920, 1080 # Set your canvas width and Height | |
myFont = '/path/VarFont.ttf' # Paste the path of your font | |
installFont(myFont) # Install the font | |
print(listFontVariations(myFont)) # Get the Data of your variable font | |
# Set variables for the axes you want to try | |
minVal = listFontVariations(myFont)['wght']['minValue'] | |
maxVal = listFontVariations(myFont)['wght']['maxValue'] |
This file contains 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
''' | |
Blackletter grid generator | |
Generador de retícula para letra gótica | |
- | |
Eduardo Aire Torres 2020 | |
''' | |
# Size of your pen / Tamaño de tu pluma | |
mmPen = 7 # Size in mm / Tamaño en mm |
This file contains 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
# Tribute for Joy Division's Unknown Pleasures album cover | |
side = 1080 | |
def lsPts(): | |
points = [] | |
m = side*0.3 | |
for i in range(0, int(side*0.8), 12): | |
x = i | |
if side*0.2 >= i < side*0.4 or side*0.6 < i <= side*0.8: |