Skip to content

Instantly share code, notes, and snippets.

Brent O'Connor epicserve

View GitHub Profile
epicserve / .dockerignore
Last active Dec 27, 2017 — forked from jefftriplett/.dockerignore
How I use Docker and Compose
View .dockerignore
View js_pattern.js
function Thing(name) {
this.thing = name;
Thing.prototype = {
get_thing: function() {
return this.thing;
View pears.yml
- name: pears
root: ~/Sites/oeie/pears
layout: main-vertical
- workon pears
- workon pears && ./ rqworker default low
- workon pears && ./ runserver
- gulp
View _media_queries.scss
* ------------------------------------------------------------------------- */
$tablet_landscape_width: "1024px";
$tablet_portrait_width: "768px";
$phone_landscape_width: "667px";
$phone_portrait_width: "375px";
Mixin for Media Queries
View connect_to_vpn.scpt
-- 1. Place in ~/Library/Scripts and enable the Applescript menu via the Applescript Editor
-- (Or export to .app to run from spotlight.)
-- 2. Set domainName, vpnGroup and securePassword to their correct values for your VPN server and password
-- 3. Open Security & Privacy System Preferences, go to Privacy, Accessibility
-- 4. Enable Applescript Editor and System UI Server (or for this .app if so exported)
-- 5. Trigger script from the menu (or run from spotlight)
-- 6. Enjoy being connected
-- 7. Run script again to close connection
epicserve /
Last active Aug 29, 2015
A handy little mixin for adding related objects to a view like DeleteView.
from django.views.generic.base import ContextMixin
from django.contrib.admin.utils import NestedObjects
class RelatedObjectsMixin(ContextMixin):
"""Adds the related_objects list to a views context """
def get_context_data(self, **kwargs):
context = super(RelatedObjectsMixin, self).get_context_data(**kwargs)
collector = NestedObjects(using='default')
epicserve /
Created Sep 17, 2014
Example of using bleach to strip out bad/evil code.
from django import template
from django.utils.safestring import mark_safe
import bleach
register = template.Library()
def strip_tags(text, valid_tags=['p', 'a', 'strong', 'em', 'ol', 'ul', 'li']):
if not isinstance(valid_tags, list):
View pagination.html
{% if is_paginated %}
{% load i18n %}
<ul class="pagination">
<li{% if not page_obj.has_previous %} class="disabled"{% endif %}><a href="{% if not page_obj.has_previous %}#{% else %}?page={{ page_obj.previous_page_number }}{{ getvars }}{% endif %}">&laquo;</a></li>
{% if show_first %}
<li><a href="?page=1{{ getvars }}">1</a></li>
{% endif %}
You can’t perform that action at this time.