Skip to content

Instantly share code, notes, and snippets.

View MaddoxRauch's full-sized avatar
👾
Trying to stay focused

Mark Rauch Richards Jr. MaddoxRauch

👾
Trying to stay focused
View GitHub Profile
@MelleB
MelleB / Kivy Aligned TextInput
Last active April 11, 2025 05:51
Kivy Aligned Text Input - halign + valign for TextInput
Note: This just aligns the position of the textblock, not the text itself.
@alberto-santini
alberto-santini / local-minima-and-maxima.py
Created November 25, 2018 21:06
Detect local minima and maxima in a Python list
def flatten(a):
return sum(a, [])
def local_minima(a):
if len(a) < 2:
return list(range(len(a)))
lmin = True
curr = list()
local_minima = list()
@MaddoxRauch
MaddoxRauch / Kivy Aligned TextInput
Last active November 19, 2021 04:21 — forked from MelleB/Kivy Aligned TextInput
Kivy Aligned Text Input - halign + valign for TextInput
Note: This just aligns the position of the textblock, not the text itself.
@MaddoxRauch
MaddoxRauch / multiexpressionbutton.py
Last active August 3, 2022 12:00
Kivy Multi-Expression Button (on_long_press, on_single_press, on_double_press events)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
MultiExpressionButton extends the Kivy Button object and adds three different events; on_single_press,
on_double_press, and on_double_press. DOUBLE_PRESS_TIME determines how long it will wait for the second press before
concluding it is a single press and LONG_PRESS_TIME determines how long the button must be held down to be considered
a long press.
"""
from kivy.uix.button import Button
@MaddoxRauch
MaddoxRauch / pyanal.py
Last active November 19, 2021 04:21
Just add import and class to python file, then you can use as a wrapper to functions using '@timetrack' to see how long it takes to execute. Or keep file separate and use 'from pyanal import TimeTrack' and use as wrapper.
import timeit
class TimeTrack:
def __init__(self, func):
start = timeit.default_timer()
func()
stop = timeit.default_timer()
print("Time to get %s" % (stop-start))