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 | |
| from linklooker.linklooker import Links, Link | |
| import argparse | |
| def output_results(results): | |
| if not results: | |
| exit("Couldn't find any results!") | |
| #TODO: use for -v mode | |
| #import os |
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
| def output_results(results): | |
| if not results: | |
| exit("Couldn't find any results!") | |
| #TODO: use for -v mode | |
| #import os | |
| #for row in results: | |
| # for key in row.keys(): | |
| # print '{} {}'.format(key, row[key]) | |
| # print os.linesep |
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 | |
| from linklooker.linklooker import Links, Link | |
| import argparse | |
| def output_results(results): | |
| if not results: | |
| exit("Couldn't find any results!") | |
| #TODO: use for -v mode | |
| #import os |
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
| {"meta": {"limit": 20, "next": null, "offset": 0, "previous": null, "total_count": 1}, "objects": [{"id": "1", "people": ["/api/v1/person/10/"], "resource_uri": "/api/v1/basket/1/"}]} |
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
| <?php | |
| $dbh = new PDO('mysql:dbname=db_old;host=localhost', 'tiger', 'secret'); | |
| $dbh->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING ); | |
| $stmt = $dbh->prepare('SELECT * FROM Pages'); | |
| $stmt->execute(); | |
| // get the row using PDO_FETCH_BOTH (default if not specified as parameter) | |
| // other modes: PDO_FETCH_NUM, PDO_FETCH_ASSOC, PDO_FETCH_OBJ, PDO_FETCH_LAZY, PDO_FETCH_BOUND |
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(){ | |
| var Person = Backbone.Model.extend(); | |
| var People = Backbone.Model.extend({ | |
| 'url': '/api/v1/basket/', | |
| model: Person | |
| }); | |
| var Baskets = Backbone.Collection.extend({ | |
| model: People, | |
| 'url': '/api/v1/basket/' |
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
| {"meta": {"limit": 20, "next": null, "offset": 0, "previous": null, "total_count": 1}, "objects": [{"id": "1", "people": ["/api/v1/person/10/"], "resource_uri": "/api/v1/basket/1/"}]} |
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(){ | |
| var Person = Backbone.Model.extend(); | |
| var Baskets = Backbone.Collection.extend({ | |
| 'url': '/api/v1/basket/' | |
| }); | |
| var baskets = new Baskets; | |
| baskets.fetch(); | |
| var basket = baskets.at(0); | |
| console.dir(baskets); | |
| console.dir(basket); |
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 people.models import Basket, Person | |
| >>> bs = Basket.objects.all() | |
| >>> for b in bs: print b.person_set.all() | |
| ... | |
| [<Person: Suckka MC>] |
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 tastypie.resources import ModelResource, ALL_WITH_RELATIONS | |
| from people.models import Basket, Person | |
| from tastypie import fields | |
| from tastypie.authentication import Authentication | |
| from tastypie.authorization import Authorization | |
| class BasketAuthorization(Authorization): | |
| def is_authorized(self, request, object=None): | |
| if request and hasattr(request, 'user') and hasattr(request.user, 'employer'): | |
| return True |