Skip to content

Instantly share code, notes, and snippets.

View erdavids's full-sized avatar

Eric Davidson erdavids

View GitHub Profile
extends RigidBody
var rotating = false
var prev_mouse_position
var next_mouse_position
func _process(delta):
if (Input.is_action_just_pressed("Rotate")):
rotating = true
w, h = 1000, 1000
colors = [[(188, 216, 193), (214, 219, 178), (227, 217, 133), (229, 122, 68)], [(219, 177, 188), (211, 196, 227), (143, 149, 211), (137, 218, 255)], [(191, 107, 99), (217, 163, 132), (91, 158, 166), (169, 212, 217)]]
random_colors = int(random(3))
def get_random_element(l):
return l[int(random(len(l)))]
def deformed_circle(x, y, r, random_colors):
shader_type canvas_item;
uniform vec4 color_1 = vec4(.0, .0, .0, 1.0);
uniform vec4 color_2 = vec4(0.5, 0.5, 0.5, 1.0);
void fragment() {
vec4 colors[2] = {color_1, color_2};
float min_diff = -1.0;
// 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;
extends Node2D
var messages = [
"My First Message",
"Second Message For You"
]
var typing_speed = .1
var read_time = 2
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
import random
# First element is the attack, the following elements are weaknesses
attacks = [
['rock', 'paper'],
['paper', 'scissors'],
['scissors', 'rock']
]
# Tracking game progress
@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):
<div class="row_2">
<div class="column_6">
<div id="sketchdiv" style="min-height: 1px;">
</div>
</div>
</div>
.row_2::after {
content: "";
clear: both;
display: table;
}
.column_6 {
float: left;
width: 100%;
padding: 5px;