Skip to content

Instantly share code, notes, and snippets.

View AphonicChaos's full-sized avatar

AphonicChaos AphonicChaos

View GitHub Profile
Edit: had to remove >< from the output otherwise it wasn't displayed here.
It might be worth noting that I already have a Python installation.
I have managed to get gdb running. As for the frame # command, I couldn't see which number contained the fault so I tried a few of the ones listed at random, they just returned the same info from the bt list:
botstrapping Kivy @ C:\Kivy\
Setting Environment Variables:
#################################
GST_REGISTRY
@AphonicChaos
AphonicChaos / pytest
Created August 6, 2012 19:49
Comparison of test frameworks
py.test tests/system
============================= test session starts ==============================
platform linux2 -- Python 2.7.3 -- pytest-2.2.3
collecting ... collected 33 items
tests/system/test_clock.py ..
tests/system/test_time.py ..........
tests/system/test_vector2.py ..........
tests/system/test_vector3.py ...........
@AphonicChaos
AphonicChaos / gist:3277954
Created August 6, 2012 19:51
example failed output
============================= test session starts ==============================
platform linux2 -- Python 2.7.3 -- pytest-2.2.3
collecting ... collected 35 items / 4 errors
tests/network/test_http.py .E
tests/system/test_clock.py ..
tests/system/test_time.py ..........
tests/system/test_vector2.py ..........
tests/system/test_vector3.py ...........
@AphonicChaos
AphonicChaos / gist:3299103
Created August 8, 2012 21:49
kivy utils bench marks
from functools import partial
from timeit import timeit
from kivy.utils import *
x, y = range(10), range(5, 15)
intersection(x, y)
# OUT: [5, 6, 7, 8, 9]
intersection2(x, y)
# OUT: [5, 6, 7, 8, 9]
difference(x, y)
# OUT: [0, 1, 2, 3, 4]
@AphonicChaos
AphonicChaos / gist:3773327
Created September 23, 2012 22:48
Event Filtering Suggestion
import sfml as sf
import alligator as ag
# yours
while window.is_opened:
# handle and filter events
remaining_events = interface.handle_events(window.pending_events)
# your event processing loop as usual
for event in remaining_events:
@AphonicChaos
AphonicChaos / gist:3773356
Created September 23, 2012 22:59
MainWindow suggestion
# I grepped the lib directory and was unable to actually find "MainWindow". That said, I don't think it's a good idea anyways...
# yours
window = ag.MainWindow(sf.VideoMode(640, 480), "pySFML2 - my first Aligator app")
# mine
# Only a nine character difference
window = ag.Ui(sf.RenderWindow(sf.VideoMode(640, 480), "pySFML2 - my first Aligator app"))
# If users are really creating *that* many windows, they could write a lambda to save some typing.
@AphonicChaos
AphonicChaos / gist:3773539
Created September 24, 2012 00:17
event binding suggestion
# I think it would be nice to convert bind from an instance method to a module function.
# yours
def print_mouse_in():
print("The cursor has entered the widget's area")
def print_mouse_out():
print("The cursor has left the widget's area")
myimage.bind(ag.MOUSE_IN, print_mouse_in)
myimage.bind(ag.MOUSE_OUT, print_mouse_out)
@bind([widget_a, widget_b], ag.MOUSE_IN)
def foo():
pass
# or
@bind({
widget_a: ag.MOUSE_IN,
widget_b: ag.MOUSE_OUT{)
def foo():
pass
@AphonicChaos
AphonicChaos / deckdsl.hs
Last active August 29, 2015 13:56
Just me progressing from a simple deck file to a (n as of yet unwritten) Deck Monad
{- | super simple format
1 Elvish Druid
2 Elvish Swordsman
1 Elvish Marksman
While this is simple enough to parse, if we wanted to do something like
live decks, it we'd have to implement a custom parser, which I'd only want
to do as a last resort.
from timeit import timeit
children = range(1, 1000)
number = 10000
def indexof(x):
for i in range(len(children)):
if children[i] is x:
return i