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
function test_scroll_view() | |
cur_photo = display.newSprite("photo.jpg") | |
scroll_view = CCScrollView:create() | |
scroll_view:setContainer(cur_photo) | |
scroll_view:setViewSize(CCSizeMake(640, 960)) | |
self:addChild(scroll_view) | |
end |
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
function main() | |
triangle = CCPointArray:create(3) | |
triangle:add(CCPoint(-100, -100)) | |
triangle:add(CCPoint(100, -100)) | |
triangle:add(CCPoint(0, 100)) | |
content = display.newSprite("Target.jpg") |
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
class ApiBaseHandler(BaseHandler): | |
def prepare(self): | |
sign = self.get_argument('sign', None) | |
platform = self.get_argument('platform', None) | |
if not (sign and platform) or \ | |
not self.verify_sign(platform, self.request.arguments, sign): | |
jsonData = {'status': 401, 'result': 'Bad Sign'} | |
self.write(jsonData) | |
self.finish() |
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
"""Utilities for with-statement contexts. See PEP 343.""" | |
import sys | |
from functools import wraps | |
__all__ = ["contextmanager", "nested", "closing"] | |
class GeneratorContextManager(object): | |
"""Helper for @contextmanager decorator.""" |
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 PEP-343 | |
mgr=statement | |
exit=type(mgr).__exit__ #not calling it yet | |
value = type(mgr).__enter__(mgr) | |
exc = True | |
try: | |
try: | |
var=value #only if "as var " is present | |
block | |
except: |