Skip to content

Instantly share code, notes, and snippets.

View eduairet's full-sized avatar

Eduardo Aire eduairet

View GitHub Profile
@eduairet
eduairet / mysteryOrganismStarter.js
Created March 31, 2021 21:05
Mysterious Organism Challenge Project (JavaScript)
// 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 March 31, 2021 21:11
Credit Card Checker Challenge Project (JavaScript)
// 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 February 3, 2021 08:35
DrawBot.app script to generate a waterfall of items
# 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 November 3, 2020 19:12
This gist is intended to be used with the DrawBot app to test your Variable Fonts in an easy way
# 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 June 10, 2020 18:38
Script to generate with DrawBot a grid to practice blackletter calligraphy
'''
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 March 21, 2020 21:28
This code is intended to generate a Joy Division's Unknown Pleasures album cover image using DrawBot app
# 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: