Skip to content

Instantly share code, notes, and snippets.

Avatar

Eduardo Aire eduairet

View GitHub Profile
@eduairet
eduairet / mysteryOrganismStarter.js
Created Mar 31, 2021
Mysterious Organism Challenge Project (JavaScript)
View mysteryOrganismStarter.js
// 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++) {
@eduairet
eduairet / creditCardValidator.js
Last active Mar 31, 2021
Credit Card Checker Challenge Project (JavaScript)
View creditCardValidator.js
// 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
@eduairet
eduairet / randomShapes.py
Created Feb 3, 2021
DrawBot.app script to generate a waterfall of items
View randomShapes.py
# 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
@eduairet
eduairet / varFontDrawBotTest.py
Created Nov 3, 2020
This gist is intended to be used with the DrawBot app to test your Variable Fonts in an easy way
View varFontDrawBotTest.py
# 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']
@eduairet
eduairet / blackletter_grid.py
Created Jun 10, 2020
Script to generate with DrawBot a grid to practice blackletter calligraphy
View blackletter_grid.py
'''
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
@eduairet
eduairet / unknown_pleasures.py
Last active Mar 21, 2020
This code is intended to generate a Joy Division's Unknown Pleasures album cover image using DrawBot app
View unknown_pleasures.py
# 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: