Skip to content

Instantly share code, notes, and snippets.

@jaredlewis
jaredlewis / 0_reuse_code.js
Created December 10, 2015 15:05
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@jaredlewis
jaredlewis / gist:5923392
Created July 3, 2013 22:28
Matrix sorter
// Create the class takes a single argument of the matrix to sort
var MatrixSorter = function(matrix){
this.matrix = matrix || [];
return this.init();
};
// Prototype the Class
MatrixSorter.prototype = {
/**
class SubjectStoryQuerySet(QueryBuilderQuerySet):
class Meta:
model = 'stories.Story'
def __init__(self, *args, **kwargs):
super(SubjectStoryQuerySet, self).__init__(*args, **kwargs)
# Create the intermediate queries
self.subject_stories_query = Query().from_table(
table='subjects_subject_topics',
def deploy():
<<<<<<< HEAD
"""
Deploys new code to servers
"""
execute(__backup__())
execute(__pull__())
execute(__install_requirements__())
execute(syncdb())
execute(__collectstatic__())
DEBUG_TOOLBAR_PANELS = (
'debug_toolbar.panels.version.VersionDebugPanel',
'debug_toolbar.panels.timer.TimerDebugPanel',
'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel',
'debug_toolbar.panels.headers.HeaderDebugPanel',
'debug_toolbar.panels.request_vars.RequestVarsDebugPanel',
'debug_toolbar.panels.template.TemplateDebugPanel',
'debug_toolbar.panels.sql.SQLDebugPanel',
'debug_toolbar.panels.signals.SignalDebugPanel',
# 'debug_toolbar.panels.logger.LoggingPanel',
SELECT
story.id
FROM stories_story AS story
JOIN stories_storyprovider AS storyprovider
ON story.id = storyprovider.story_id
JOIN sources_provider AS provider
ON storyprovider.provider_id = provider.id
WHERE (provider.uuid IN ('ca940d2324cc4d5886f7feb7717e3a49','1030c332bbb949528765360f029e4d02','5897643055f9490bb6f0141a9a81a710','953bd4d9973b40a8b10c69605fdb74ac','aa1d51cb09e444309a3b68222b1a1c08','f511a1abad5d4aeca81da152098645ca','e233709c3d83461b85f8cf7fc0d7ec90','930c8e2efdae4491ac1afedbbdccbfd5','e993414531044801bb0fe5f2cd5e7f5e','c8339c8ec5c04a25a36b129a5e0b3439','0c0e0d2f935c463a8131b78c327ca7fa','8e924759c7f34d82b86533418dedb84a','fb3f76510c7f4a1a83dc6377e4cb2b42','70d8039a46414d5f8c62fe25fc989a06','a43722a132c14b919b9595f0d4570acc','a8c831514b4d401b9e3ee55d862c611d','0bd975a50bd546cb8c261404ed24d1c2','c08a5ecf91b64e16a56dfb111632511a','eac9e90c0f9e48b794750287253b49c7','9d3bd390e6a847dfba9a29f0acec45fb','fec806b058a44a77944e0071eb333087','dce357ef4a2a4f319e6e5fcbaa18b8c1','bb5adab48f70467d9d4
from .base_development import *
HTTP_PROTOCOL = "http"
STATIC_URL = '/static/'
MEDIA_URL = 'https://mynews-media.s3.amazonaws.com/'
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
}
from .base_development import *
# External Akimbo / Fireplug APIs - Note this will make some tests fail
SOURCEPROXIES_API = "http://127.0.0.1:8000"
SITE_ID = 2
HTTP_PROTOCOL = "http"
STATIC_URL = '/static/'
MEDIA_URL = 'https://mynews-media.s3.amazonaws.com/'
CACHES = {
{# Footer Scripts #}
{% block footer_scripts %}
{{ block.super }}
<script type="text/javascript">
require(['base'], function(){
var $ = require('jquery');
$(document).ready(function(){
$("#id_email").attr('placeholder', 'Email Address');
});
});
ERROR:django.request:Internal Server Error: /user/a@a.com/interactions
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/sleepy/sleepy/base.py", line 135, in __call__
response = getattr(self, request.method)(request, *args, **kwargs)
File "/Users/jaredlewis/projects/python/akimbo/sleepy/sleepy/decorators.py", line 36, in _requires_parameters_check
return fn(self, request, *args, **kwargs)
File "/Users/jaredlewis/projects/python/akimbo/my-news-api/mynews/users/auth/decorators.py", line 23, in _requires_authentication_check
return fn(self, request, *args, **kwargs)