Skip to content

Instantly share code, notes, and snippets.

View joereynolds's full-sized avatar

Joe Reynolds joereynolds

View GitHub Profile
@joereynolds
joereynolds / gist:abc4bafc629e1adc75438f8f23f618ba
Last active October 4, 2024 12:23
death_cross_particle.py
def build(x: int, y: int, level, components: dict) -> List[Particle]:
particle_width = 1
particle_height = 1
random_width_offset = random.randint(-8, 8)
random_height_offset = random.randint(-4, 4)
valid_velocities = [
[{'x': 0, 'y': 1}],
[{'x': 0, 'y': -1}],
[{'x': 1, 'y': 0}],
@joereynolds
joereynolds / grid.py
Last active August 6, 2024 18:59
Spatial grid prepopulation
from collections import namedtuple
from typing import Tuple
cells: dict[Tuple[int, int], list] = {
(i, j) : []
for i in range(10)
for j in range(10)
}
@joereynolds
joereynolds / animates.py
Last active January 12, 2024 08:53
Pygame animation class
import pygame
from src.countdown_timer import CountdownTimer
import src.config.events as e
class Animates:
def __init__(
self,
parent: pygame.sprite.Sprite,
frames,
named_frames: dict = {},
<?php
interface PaymentProvider
{
public function purchase();
}
class BrainTreePaymentProvider implements PaymentProvider
{
public function purchase()
@joereynolds
joereynolds / report_unused_functions.sh
Last active February 7, 2021 11:31
Rough and naive script to find unused functions in php files
#!/bin/bash
function report_unused_functions() {
# Find the function
# Remove the ampersands for pass by reference functions
# Remove everything after and including the ( in the function name
git grep -Ei '(public|private|protected) function' $1 | awk '{print $4}' | tr -d '&' | cut -f1 -d"(" | while read -r function ; do
match_count="$(git grep -i $function| wc -l)"