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
from contextlib import contextmanager | |
from django.contrib.messages.storage.base import BaseStorage, Message | |
from django.test.client import RequestFactory | |
from django.utils.decorators import method_decorator | |
class TestMessagesBackend(BaseStorage): | |
def __init__(self, request, *args, **kwargs): | |
self._loaded_data = [] | |
super(TestMessagesBackend, self).__init__(request, *args, **kwargs) | |
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
(function($, undefined) { | |
var uiPopoverClasses = 'ui-popover '; | |
var openPopover = null; | |
$.widget("ui.popover", { | |
// Default options | |
options: { | |
offsetX: 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
SOME_SETTING = 'some value' |
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
# list_detail.object_list replacement with all the things I need | |
def object_list(request, queryset, extra_context=None, | |
template_name='', paginate_by=None): | |
class ObjectList(ListView): | |
def post(self, request, *args, **kwargs): | |
return self.get(request, *args, **kwargs) | |
def get_context_data(self, **kwargs): | |
c = super(ObjectList, self).get_context_data(**kwargs) |
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head> | |
<link rel="stylesheet" href="http://code.jquery.com/qunit/git/qunit.css" type="text/css" media="screen" /> | |
<!-- when.js Promises implementation --> | |
<script src="https://raw.github.com/cujojs/when/master/when.js"></script> | |
<!-- Unit testing and mocking framework --> | |
<script type="text/javascript" src="http://code.jquery.com/qunit/git/qunit.js"></script> |
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
from flask import Flask, jsonify, Blueprint, current_app | |
import json | |
## REST api ################################################################### | |
api = Blueprint('api', __name__) | |
@api.route("/users") | |
def users(): | |
return jsonify(users=[ |
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
_.mixin({ | |
// Get/set the value of a nested property | |
deep: function (obj, key, value) { | |
var keys = key.replace(/\[(["']?)([^\1]+?)\1?\]/g, '.$2').replace(/^\./, '').split('.'), | |
root, | |
i = 0, | |
n = keys.length; |
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
from django.template.defaultfilters import slugify | |
from django.contrib.sites.models import Site | |
from django.core.files import File | |
from taggit.models import Tag | |
from .models import Photo | |
import factory | |
import os | |
TEST_MEDIA_PATH = os.path.join(os.path.dirname(__file__), 'tests', 'test_media') | |
TEST_PHOTO_PATH = os.path.join(TEST_MEDIA_PATH, 'test_photo.png') |
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
define([ | |
"underscore", | |
"backbone", | |
"marionette", | |
"vent" | |
], | |
/** | |
* Creates the primary `Marionette.Application` object that runs the admin framework. Provides a central point | |
* from which all other sub-applications are started, shown, hidden, and stopped. |
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
#!/bin/bash | |
# | |
# Integrate our branch into origin/develop | |
# | |
# It's a shortcut for : | |
# | |
# 1. pull for last changes on develop | |
# 2. rebase the target branch against develop | |
# 3. recheck if no changes happen in the meanwhile | |
# 4. merge --no-ff |
OlderNewer