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
| # multipart | |
| curl http://127.0.0.1:8000/api/v1/places/ -F "image[]=@static/for_test/image1.jpg" -F "image[]=@static/for_test/image2.jpg" | |
| # login | |
| curl -u login:password -i -X GET http://127.0.0.1:8000/api/v1/login |
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
| -module(map_reduce). | |
| -export([start/1]). | |
| -export([reduce/3, map/2]). | |
| merge_keyval(Key, Value, Map) -> | |
| case maps:find(Key, Map) of | |
| {ok, Old} -> maps:update(Key, Value + Old, Map); | |
| error -> maps:put(Key, Value, Map) |
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 tornado.gen import coroutine | |
| from tornado.web import RequestHandler, authenticated | |
| class AddDecorators(type): | |
| METHODS = ('get', 'post', 'delete', 'put') | |
| def __new__(cls, name, bases, class_dict): | |
| add_decorator = lambda key, value: coroutine(authenticated(value)) if isfunction(value) and key in cls.METHODS else value | |
| new_class_dict = {key: add_decorator(key, value) for key, value in class_dict.items()} |
NewerOlder