Skip to content

Instantly share code, notes, and snippets.

WITH subject_points AS (
SELECT
subject.id subject_id,
subject.name subject_name,
achievement.user_id user_id,
SUM(achievement.points) points
FROM subjects_subject_topics subject_topic
LEFT JOIN subjects_subject subject
ON subject.id = subject_topic.subject_id
LEFT JOIN subjects_topic topic
# Get a list of the entities
entities = Entity.objects.filter(id__in=topic_ids)
# Build the query to get the entity instances
entity_story_query = EntityInstance.objects.filter(
entity_id__in=topic_ids,
story__content_type__app_label__iexact='sources',
story__content_type__model__iexact='xmlfeedsource',
).distinct(
'story__update_time',
def setUp(self):
self.client = Client()
def make_topic_endpoint_get_request(self, parameters=None):
if parameters is None:
parameters = {}
return self.client.get(
"/{0}".format(
self.topic_endpoint,
https://sourceproxies.firepl.ug/sources/stream?num_stories=25&source_uuids=afa71f1c7fc94aca88174f930ba28079%2C340d9ef6185a494ca37256736bc46500%2C1aa3a63fc8a54138b049fdf5cf9aff25%2Cbc2b55eff16f4d908d687d53106047ab%2C2c3fdbfb88a04609ba454eb9c0d77aa3%2C71efbd42448c4e768a3a18f9cadeb9a6%2C3dac5d35f2004b0ba95370ecab653ed4%2Cb539cb63ad31498698e97054665e65e9%2C4f91536ae0884b8e97914cf73ddbb49c%2C528271d1438d47d0a7d8f84014456354%2Ca85b63763fcb4e2bb7b8e9dcb19c9993%2C1f33e88ec63a4e9aa4615d4b28ebeba0%2C63e9748b238142c4bdc008953f4db869%2C9ce1fe408ec2411c8ebf3c8639414838%2C5181f378a511403891de0a3d5a8ba082%2Cfec806b058a44a77944e0071eb333087%2C9dcf41b3df114202a50242829f2ee2d4%2C4579af4c4670409fbb1293c07267b5f4%2C611ff76b9e7143e0951b26fa8857d998%2C1fca29d8de8245438ced56d0351216c7%2C3b93bb2063964a3e83b7815782023df4%2C08b3b50dd2b54967a5dd7ebc5b69cbda%2C9812d84f504f49a48ca3b54ae73a8bc2%2C70d8039a46414d5f8c62fe25fc989a06%2Cc4cd3696c8a24e6cb0608e49e0377c2c%2C37c39765f2824304adf5fb379846db1c%2C9c128397d1784b56a20772fa4d8eb0ee%2Cf2ec
# Get the stories from source proxies
stories = []
source_stream_url = settings.SOURCEPROXIES_API + "/sources/stream"
source_stream_params = {
"source_uuids": ",".join([str(source_uuid) for source_uuid in source_uuids]),
"offset": offset,
"num_stories": num_stories,
"older_than": older_than,
"newer_than": newer_than,
"exclude_id_list": exclude_id_list
Traceback (most recent call last):
File "/Users/jaredlewis/projects/python/akimbo/my-news-api/env/lib/python2.7/site-packages/django/core/handlers/base.py", line 111, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/Users/jaredlewis/projects/python/akimbo/my-news-api/env/lib/python2.7/site-packages/sleepy/base.py", line 131, in __call__
response = getattr(self, request.method)(request, *args, **kwargs)
File "/Users/jaredlewis/projects/python/akimbo/my-news-api/env/lib/python2.7/site-packages/sleepy/decorators.py", line 65, in _requires_url_attribute_check
return fn(self, request, *args, **kwargs)
File "/Users/jaredlewis/projects/python/akimbo/my-news-api/env/lib/python2.7/site-packages/sleepy/decorators.py", line 137, in _transform
return fn(self, request, *args, **kwargs)
File "/Users/jaredlewis/projects/python/akimbo/my-news-api/env/lib/python2.7/site-packages/sleepy/decorators.py", line 137, in _transform
$.ajax({
type: "POST",
url: "/some/new/endpoint/to/get/data/from",
data: {
param1: 'value1',
param2: 'value2'
},
success: function(response){
console.log(response);
},
var Travis = {
isCrushing: function(){
return false;
},
hasTinyThighs: function(){
return true;
}
};
console.log(Travis.isCrushing());
var iosHeader = $('#ios-box-header');
var body = $('body');
var profileContainer = $('#fireplug-profile-container');
var lastScrollTop = 0;
$(window).on('scroll', function(){
var iosHeaderTop = iosHeader.offset().top;
var scrollTop = body.scrollTop();
if(lastScrollTop <= iosHeaderTop && scrollTop >= iosHeaderTop){
console.log('scroll time');
profileContainer.animate({
# Add the request user to the class, this allows certain django decorators to work
if hasattr(request, 'user'):
self.user = request.user