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
var ლ = function(wat) { console.log(wat); } | |
var ಠ益ಠლ = 'wat' | |
ლ(ಠ益ಠლ) // prints wat |
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 YourResource(ModelResource): | |
custom_field = fields.CharField() | |
def dehydrate_custom_field(self, bundle): | |
return "this is a custom field" | |
def hydrate_custom_field(self, bundle): | |
do_something_with(bundle.data.get('custom_field', 'default')) | |
return bundle |
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
Germanic Language Word for element "Na" | |
----------------- --------------------- | |
German | Natrium | |
Icelandic | Natríum | |
Dutch | Natrium | |
Norwegian | Natrium | |
Swedish | Natrium | |
English | Sodium |
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
''' | |
API V2 | |
Focus on: | |
- Minimalistic interfaces | |
- Simple authorization types | |
- NO full=True EVER | |
- NO use of request.user.current_course | |
- Full unit test coverage |
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 MyBaseResource(ModelResource): | |
# a resource class that dynamically limits fields | |
def full_dehydrate(self, bundle): | |
# Dehydrate each field. | |
for field_name, field_object in self.limit_fields(bundle): | |
# ... | |
# ... | |
def limit_fields(self, bundle): |
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
var CourseMembership = Backbone.Model.extend({ | |
// ... | |
toJSON: function () { | |
var attrs = _.clone(this.attributes); | |
if (_.isObject(attrs.course)) { | |
attrs.course = attrs.course.url(); | |
} | |
return attrs; | |
}, | |
// ... |
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
[('id', '20010911080409a'), | |
('time', '52163.3363310185'), | |
('exposure', '20'), | |
('ra', '20.011935'), | |
('dec', '-7.63364'), | |
('ra0', '19.915845'), | |
('dec0', '-7.53'), | |
('nx', '4080'), | |
('ny', '4080'), | |
('sequence', '0'), |
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 MyResource(ModelResource): | |
list_only_field = fields.CharField('list_this_attr', use_in='list') | |
detail_only_field = fields.CharField('detail_this_attr', use_in='detail') | |
both_field = fields.CharField('always_attr') # use_in='all' by default |
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
job = group(tq_make_notification_for_user_range(i,i+1000) for i in range(1, user_count, 1000)) | |
job.apply_async() |
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
trees = course_pack.trees.all().values_list('data', flat=True) |