Skip to content

Instantly share code, notes, and snippets.

View grudelsud's full-sized avatar
😜
specialisation is for insects

Thomas Alisi grudelsud

😜
specialisation is for insects
View GitHub Profile
class BaseModel(ndb.Model):
@classmethod
def populate(cls, key):
self = key.get()
sources = getattr(self.__class__, 'sources', False)
source_data = {}
if not sources:
return False
for source_name in sorted(sources.keys(), key=lambda k: 0 if k == 'gplus' else 9):
source_id_property = 'source_id_' + source_name
class ClubNight(BaseModel):
"""club nights are series of events and organized by someone. e.g. 'don't look back'"""
name = ndb.StringProperty()
content = ContentProperty(ndb.TextProperty)
blob_key_logo = ContentProperty(ndb.BlobKeyProperty, verbose_name='Club night logo')
genre = ndb.KeyProperty(kind='Genre')
website = ContentProperty(ndb.StringProperty)
address = ContentProperty(ndb.TextProperty)
location = ContentProperty(ndb.GeoPtProperty)
@grudelsud
grudelsud / webspeech_miclevel.js
Created April 23, 2013 09:12
sample code of mic level + webspeech. the code kind of works, but asks twice for mic authorization.
var that = this;
var recognition = new webkitSpeechRecognition();
recognition.continuous = true;
recognition.interimResults = true;
recognition.onstart = function()
{
var context = new webkitAudioContext();
navigator.webkitGetUserMedia(
@grudelsud
grudelsud / index.html
Created August 24, 2012 15:02
initialize google maps with twitter bootstrap tabs
<!-- content -->
<div class="span10">
<!-- tabs -->
<div class="tabbable">
<ul class="nav nav-tabs">
<li class="active"><a href="#tab_media" data-toggle="tab">View</a></li>
<li><a href="#tab_map" id="tab_map_link" data-toggle="tab">Visit</a></li>
</ul>
</div>
@grudelsud
grudelsud / gist:1312872
Created October 25, 2011 14:16
video awaiting rendering
<videos>
<video>
<backplate_file_name>backplate110922.mp4</backplate_file_name>
<clip_duration>3.4</clip_duration>
<cut_point>8.4</cut_point>
<height>720</height>
<insert_point>14.5</insert_point>
<scene_id>3</scene_id>
<file_id>de00fc2ad4056cfef759b65539546db2</file_id>
<width>1280</width>