Skip to content

Instantly share code, notes, and snippets.

View epicserve's full-sized avatar

Brent O'Connor epicserve

View GitHub Profile
{% 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>
<li><span>...</span></li>
{% endif %}
@epicserve
epicserve / mixins.py
Last active August 29, 2015 14:06
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')
-- 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
/**
* MEDIA QUERY VARIABLES
* ------------------------------------------------------------------------- */
$tablet_landscape_width: "1024px";
$tablet_portrait_width: "768px";
$phone_landscape_width: "667px";
$phone_portrait_width: "375px";
/**
Mixin for Media Queries
@epicserve
epicserve / pears.yml
Last active August 29, 2015 14:27
https://github.com/TomAnthony/itermocil config file for one of my projects
windows:
- name: pears
root: ~/Sites/oeie/pears
layout: main-vertical
panes:
- workon pears
- workon pears && ./manage.py rqworker default low
- workon pears && ./manage.py runserver
- gulp

Git Notes

Good Basic Global Git Config Settings

[color]
    diff = auto
    status = auto
    branch = auto
[user]

name = Your Name

@epicserve
epicserve / OSX Clean Install Notes.markdown
Created February 22, 2010 15:22
Clean Install Notes for OSX 10.6.2 Snow Leopard

Clean Install Notes for OSX 10.6.2 Snow Leopard

These are the steps I took when migrating from OSX 10.5 Leopard to 10.6.2 Snow Leopard.

Backed up Data

Backup documents and data

Copied all my data folders in my home direcotry to an external hard drive. The direcotries in my home folder that I copied over were; Documents, Dropbox, Library, Movies, Music, Pictures, Public, Sites, code, scripts.

@epicserve
epicserve / Best TextMate Tips and Shortcuts.md
Created March 8, 2010 15:18
TextMate Tips and Shortcuts

Best TextMate Tips and Shortcuts

Shortcuts

  • ctrl-shift-D — Duplicate Line/Selection
  • alt-cmd-] — Align Assignments
@epicserve
epicserve / Python Snippets.md
Created March 9, 2010 16:31
Python Snippets

Python Snippets

List Comprehension Example:

m2mid_list = [m2m_item.pk for m2m_item in my_model.my_m2m_field.all()]

@epicserve
epicserve / is_required_version.js
Created March 17, 2010 16:06
Javascript required version check
/*
Test if the current version meets the required version number.
Examples:
Basic Usage
if (is_required_version("1.2.6", "1.1.3") === false) {
alert("This script requires version 1.2.6 and the current script's version is 1.1.3");