This file contains 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
class Flickr(RequestHandler): | |
def post(self, action): | |
self.get(action) | |
def get(self, action): | |
client = flickrapi.FlickrAPI( | |
config.FLICKR_API_KEY, | |
config.FLICKR_API_SECRET, | |
store_token = False | |
) |
This file contains 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 gevent | |
from gevent import monkey | |
# patches stdlib (including socket and ssl modules) to cooperate with other greenlets | |
monkey.patch_all() | |
from sqlalchemy import create_engine | |
engine = create_engine('postgresql+pg8000://postgres:%s@localhost/mydb' % password) | |
connection = engine.connect() |
This file contains 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
<p><object width="512" height="308"> | |
<param name="movie" | |
value="http://www.youtube.com/v/21pE9VtWZlc&fs=1" | |
/> | |
<param name="allowFullScreen" value="true" /> | |
<param name="allowscriptaccess" value="always" /> | |
<embed width="512" height="308" | |
allowfullscreen="true" | |
allowscriptaccess="always" | |
type="application/x-shockwave-flash" |
This file contains 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
<p><object width="512" height="308"> | |
<param name="movie" | |
value="http://www.youtube.com/v/nsRMCBDeUY8&fs=1" | |
/> | |
<param name="allowFullScreen" value="true" /> | |
<param name="allowscriptaccess" value="always" /> | |
<embed width="512" height="308" | |
allowfullscreen="true" | |
allowscriptaccess="always" | |
type="application/x-shockwave-flash" |
This file contains 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 | |
# -*- coding: utf-8 -*- | |
"""Abstract base classes for a gevent_ based Streaming API consumer: | |
#. a long running streaming API ``Consumer`` | |
#. a ``BaseManager`` which looks after ``Consumer`` instances | |
running in their own ``gevent.Greenlet`` thread | |
#. an ultra-simple WSGI app to recieve ``/stop``, ``/start`` and | |
``/restart`` instructions |
This file contains 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 | |
# -*- coding: utf-8 -*- | |
"""A specific implementation, using redis_ for persistence. | |
.. _redis: http://code.google.com/p/redis/ | |
""" | |
from base import BaseConsumer, BaseManager, BaseWSGIApp |
This file contains 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 | |
# -*- coding: utf-8 -*- | |
"""`Twitter Streaming API`_ consumer based on tweepy_. | |
Consumer runs asynronously in a thread. Exposes a Tornado_ | |
web server with two request handlers: | |
* ``/update`` either starts or restarts the consumer | |
* ``/stop`` stops the consumer |
This file contains 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
SHARETHIS.addEntry({}, {button: false}).attachButton(document.getElementById('share-this-button')); |
This file contains 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
class MultiDBModel(Document): | |
"""Overwrites methods of the base ``Document`` class that | |
prescribe a fixed mapping between class and database. | |
Can be used like normal but can also pass ``db=...`` | |
to methods as necessary. | |
""" | |
def save(self, db=None, **params): | |
""" Save document in database. |
This file contains 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
/* | |
for(id key in searchControlsDict) { | |
[[searchControlsDict objectForKey:key] setObject:[NSMutableArray [[[searchControlsDict objectForKey:key] objectForKey:VALUES]] forKey:VALUES] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]; | |
} | |
*/ | |
for(id key in searchControlsDict) { | |
NSMutableArray *tempValues = [[NSMutableArray alloc] initWithCapacity:0]; | |
tempValues = [[searchControlsDict objectForKey:key] objectForKey:VALUES]; |