This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="utf-8"?> | |
| <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" addedToStage="init();"> | |
| <fx:Script> | |
| <![CDATA[ | |
| private function init():void{ | |
| var handlers:Array = [ | |
| new Route(/\/api\/track\/(\d+)\/?/, TrackHandler, 'get') | |
| ]; | |
| var app:Application = new Application(handlers); | |
| var http_server:HttpServer = new HttpServer(app); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import eventlet | |
| from thrift.server.TServer import TServer | |
| from thrift.transport import TSocket; | |
| from thrift.transport.TTransport import TTransportException | |
| class TEventletServer(TServer): | |
| """Eventlet Thrift Server. Each client gets its own green thread.""" | |
| running = False | |
| backdoor = 0 | |
| def __init__(self, *args, **kwargs): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import os | |
| import sys | |
| import appscript | |
| import sys | |
| import xmlrpclib | |
| import textwrap | |
| import pkg_resources | |
| import pip.download | |
| from pip.basecommand import Command |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Monkey patch the Last.fm Python Library (http://code.google.com/p/pylast/) | |
| to add some useful track methods. | |
| """ | |
| import pylast | |
| def monkey_patch_pylast(): | |
| def _pylast_get_lastfm_album(self): | |
| """Get an Album instance from a Track instance.""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Based on Backbone.localStorage. | |
| // Idea is when offline, write to localstorage | |
| // and queue changes to send to the remote when | |
| // we come back online. | |
| // | |
| // @todo (lucas) Implement rev-ish tracking and | |
| // first in conflict resolution ala couch. | |
| // | |
| // @todo (lucas) Throttle repl calls? | |
| // |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ================================================== | |
| // Friends | |
| // ================================================== | |
| $('#friends a').live('click', function(){ | |
| $('.artists').remove(); | |
| var period = $(this).attr('id'); | |
| username = $(this).text(); | |
| $.ajax({ | |
| data: 'user='+username+'&api_key='+api_key+'&format=json&limit=25&period='+period, | |
| url: topArtists, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Artist = Backbone.Model.extend({ | |
| defaults: { | |
| 'name': 'An Artist', | |
| 'image': 'images/loading.gif' | |
| } | |
| }); | |
| var ArtistList = Backbone.Collection.extend({model: Artist}); | |
| var User = Backbone.Model.extend({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import re | |
| import simplejson | |
| def camelize(value): | |
| ret = "".join([w.title() for w in re.split(re.compile("[\W_]*"), value)]) | |
| lower = ret[0].lower() | |
| return "%s%s" % (lower, ret[1:]) | |
| def decamelize(value): | |
| return re.sub(r'([a-z])([A-Z])', r'\1_\2', value).lower() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flaskext.celery import Celery | |
| from flask import current_app | |
| celery = Celery(current_app) | |
| @celery.task | |
| def add(x, y): | |
| return x+y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flaskext.celery import Celery | |
| def init(app): | |
| celery = Celery(app) | |
| @celery.task | |
| def add(x, y): | |
| return x+y |