Skip to content

Instantly share code, notes, and snippets.

View erdavids's full-sized avatar

Eric Davidson erdavids

View GitHub Profile
# Test me
Connect
import PIL, random, sys
from PIL import Image, ImageDraw
origDimension = 1500
r = lambda: random.randint(50,215)
rc = lambda: (r(), r(), r())
listSym = []
def create_square(border, draw, randColor, element, size):
if (element == int(size/2)):
draw.rectangle(border, randColor)
elif (len(listSym) == element+1):
function setup() {
var canvasDiv = document.getElementById('sketchdiv')
var width = canvasDiv.offsetWidth
var height = 600
var cnv = createCanvas(width, height);
cnv.parent('sketchdiv');
background(206, 200, 176);
}
.row_2::after {
content: "";
clear: both;
display: table;
}
.column_6 {
float: left;
width: 100%;
padding: 5px;
<div class="row_2">
<div class="column_6">
<div id="sketchdiv" style="min-height: 1px;">
</div>
</div>
</div>
@erdavids
erdavids / python-substring.py
Created November 19, 2019 19:08
Cassidoo Interview - Nov 18
def substring(*arg):
# Unknown number of arguments
arg_length = len(arg)
# Input string and output
orig = ''
out = ''
# Return original string if no other parameters are given
if (arg_length > 1):
import random
# First element is the attack, the following elements are weaknesses
attacks = [
['rock', 'paper'],
['paper', 'scissors'],
['scissors', 'rock']
]
# Tracking game progress
days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
def day_offset(day, offset):
return days[(days.index(day) + offset) % 7]
if __name__ == "__main__":
print(day_offset("Wednesday", 5)) # Monday
print(day_offset("Monday", 0)) # Monday
print(day_offset("Saturday", -1)) # Friday
extends Node2D
var messages = [
"My First Message",
"Second Message For You"
]
var typing_speed = .1
var read_time = 2
// Created from: https://github.com/hughsk/glsl-dither
// Inspired by: https://www.youtube.com/watch?v=npno7zivwrQ
shader_type canvas_item;
float dither8x8(vec2 position, float brightness) {
int x = int(mod(position.x, 8.0));
int y = int(mod(position.y, 8.0));
int index = x + y * 8;