Skip to content

Instantly share code, notes, and snippets.

View digitaldavenyc's full-sized avatar

Dave Padovano digitaldavenyc

View GitHub Profile
@digitaldavenyc
digitaldavenyc / celery.sh
Created October 4, 2017 01:37 — forked from amatellanes/celery.sh
Celery handy commands
/* Useful celery config.
app = Celery('tasks',
broker='redis://localhost:6379',
backend='redis://localhost:6379')
app.conf.update(
CELERY_TASK_RESULT_EXPIRES=3600,
CELERY_QUEUES=(
Queue('default', routing_key='tasks.#'),
@digitaldavenyc
digitaldavenyc / auth.py
Created August 10, 2017 05:14 — forked from alejandrobernardis/auth.py
Tornado, Class Role, Permission, Identity (+mixin) and AuthContext
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Asumi Kamikaze Inc.
# Copyright (c) 2013 The Octopus Apps Inc.
# Licensed under the Apache License, Version 2.0 (the "License")
# Author: Alejandro M. Bernardis
# Email: alejandro.bernardis at gmail.com
# Created: 04/Oct/2013 09:37
import urllib
@digitaldavenyc
digitaldavenyc / gist:5b6e9bea03633d62c517
Created August 29, 2014 17:12
HTTP Response Codes & Actions
def status_code_behavior(r):
"""
Holds a dictionary of all possible HTTP status codes and returns a string value.
:param code: HTTP Response status code
:return: {String}
"""
# Copied from multiple sources...
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Response_codes
# http://httpstatus.es/
<script>
var memFragConfig = {
force_desktop: true,
show_app_switcher: false,
headerContainer: 'header', // css class without '.'
mmdbHost: 'https://mmdb-staging.nationalgeographic.com',
memcenHost: 'https://membercenter-staging.nationalgeographic.com',
<script>
var memFragConfig = {
force_desktop: true,
show_app_switcher: false,
headerContainer: 'header', // css class without '.'
mmdbHost: 'https://mmdb.nationalgeographic.com',
memcenHost: 'https://members.nationalgeographic.com',
from django.conf import settings
NGS_HEADER_DIV_CLASS = getattr(settings, 'NGS_HEADER_DIV_CLASS', 'header')
HEADER_ALERT_CONTAINER = getattr(settings, 'HEADER_ALERT_CONTAINER', '#dialog-alert')
EXTERNAL_MMDB_API_HOST = getattr(settings, 'EXTERNAL_MMDB_API_HOST', 'https://mmdb.nationalgeographic.com')
MEMBERCENTER_HOST = getattr(settings, 'MEMBERCENTER_HOST', 'https://members.nationalgeographic.com')
HEADER_STATIC_MEDIA = getattr(settings, 'HEADER_STATIC_MEDIA', '//assets.nationalgeographic.com/ngs-header/')
import json
import urllib2
from django.http import HttpResponse
def send(request):
url = 'http://manage.encoding.com:80'
params = {
@digitaldavenyc
digitaldavenyc / encoding.py
Created May 5, 2014 19:28
Encoding.com AddMedia Request
import json
import urllib2
from django.http import HttpResponse
def send(request):
url = 'http://manage.encoding.com:80'
params = {
return Class.create(Base, {
initialize: function($super) {
$super(element);
},
click: function($super) {
$super(dropdown, colors, toggle);
}
});