Skip to content

Instantly share code, notes, and snippets.

View rdeaton's full-sized avatar

Robert Deaton rdeaton

  • San Francisco, CA
View GitHub Profile
Deadlock Detection:
No deadlocks found.
Thread t@312: (state = BLOCKED)
- org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.addShardFailure(int, java.lang.Throwable) @bci=80, line=336 (Interpreted frame)
- org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.onFirstPhaseResult(int, org.elasticsearch.cluster.routing.ShardRouting, org.elasticsearch.cluster.routing.ShardIterator, java.lang.Throwable) @bci=4, line=249 (Compiled frame)
- org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$3.onFailure(java.lang.Throwable) @bci=17, line=220 (Compiled frame)
- org.elasticsearch.search.action.SearchServiceTransportAction$2.handleException(org.elasticsearch.transport.TransportException) @bci=5, line=161 (Compiled frame)
- org.elasticsearch.transport.TransportService$2.run() @bci=8, line=207 (Compiled frame)
# import spyral
from functools import partial
def source(f):
return partial(f, '')
def dest(f):
return partial(f, '_dest')
class View(object):
class RegisterForm(spyral.Form):
name = spyral.TextInputWidget(self, 50, "Name")
password = spyral.TextInputWidget(self, 50, "Pass")
user_type = spyral.RadioGroup(self, map(partial(spyral.RadioButtonWidget, self), ["Admin", "User", "Guest"]))
remember_me = spyral.CheckboxWidget(self)
okay = spyral.ButtonWidget(self, "Okay")
cancel = spyral.ButtonWidget(self, "Cancel")
form = RegisterForm(scene)
@rdeaton
rdeaton / gist:4734021
Created February 7, 2013 20:47
Spyral and co todo
Spyral:
spyral.form
- Buttons
- Checkboxes
- Radio Boxes
- A complete example
spyral.group
- Obsolete, move code from the groups into spyral.camera
spyral.event
- All kinds of stuff, update to be modern, handlers, managers
[TextInput]
font: %(path)s/fonts/DejaVuSans.ttf
font_size: 42
font_color: (255, 255, 255)
font_color_hilight: (255, 255, 0)
font_color_hilight_background: (255, 255, 255, 0)
padding: 8
background: %(path)/images/TextInputWidget.png
background_focused: %(path)/images/TextInputWidget_focused.png
if orientation in ('left', 'right'):
selector = Vec2D(1,0)
else:
selector = Vec2D(0,1)
if orientation in ('left', 'above'):
reversed(sequence)
if type(padding) in (float, int, long):
padding = [padding] * len(sequence)
from spyral import Sprite, AggregateSprite
class FormWidget(object):
def get_value(self):
pass
def set_value(self, value):
pass
class TextInputWidget(Sprite, FormWidget):
Reset_Requests_table = db.Table('Reset_Requests', db.Model.metadata,
db.Column('student_id', db.Integer, db.ForeignKey('user.id')),
db.Column('teacher_id', db.Integer, db.ForeignKey('user.id')),
db.Column('approved', db.Boolean)
)
class Reset_Requests(object):
pass
mapper(Reset_Requests, Reset_Requests_table,
@rdeaton
rdeaton / gist:2838397
Created May 30, 2012 19:20
Sprite Ideas
Alternative forms of collision detection
- Possible use of algorithms like quadtrees and spatial hashing
Positioning based on tuples/numpy arrays vs Rects
Anchor points
Improved layering system
"Automated" dirty rendering
A Group which implements the Sprite protocol (aggregate sprites)
Properties which change sprites in various ways:
- angle of rotation
- scale (zoom in or out)
@rdeaton
rdeaton / gist:1612405
Created January 14, 2012 18:30
Spyral SmartMemoize fix
def __call__(self, *args):
from spyral import director
frame = director.get_tick()
if director.get_scene() is not self.scene:
self.scene = director.get_scene()
self.cache = {}
if frame - self.last_clear > 100:
self.cache = dict((key,value) for key,value in self.cache.items() if frame - value[1] > 250)
self.last_clear = frame
try: