Skip to content

Instantly share code, notes, and snippets.

View mikedory's full-sized avatar

Mike Dory mikedory

View GitHub Profile
@mikedory
mikedory / hyde_page_listing.html
Created March 24, 2012 21:09 — forked from navilan/hyde_page_listing.html
Sample code for listing a set of pages that belong to a node.
{% for node in page.node.walk %}
<ul>
{% for list_page in node.pages %}
{% if list_page.display_in_list %}
<li>
<h1><a href="{{list_page.url}}">{{list_page.title}}</a></h1>
{% if page.excerpt %}
<div class="page-excerpt">
{{ render_excerpt(list_page) }}
</div>
@mikedory
mikedory / gist:3201764
Created July 29, 2012 20:46
Python FizzBuzz (with a generator)
#!/usr/bin/env python
def fizzbuzzerize(numberRange):
for number in numberRange:
if number % 15 == 0:
yield 'Fizzbuzz'
if number % 3 == 0:
yield 'Fizz'
elif number % 5 == 0:
yield 'Buzz'
@mikedory
mikedory / gist:3299167
Created August 8, 2012 21:57
McKayla It
javascript:(function(){ var body=document.getElementsByTagName("body")[0];var mckayla="http://f.cl.ly/items/1A1w013w0Q3p380a2N3x/mckayla.png";var mckaylaDiv=document.createElement("img");mckaylaDiv.src=mckayla;mckaylaDiv.style.position="absolute";mckaylaDiv.style.width="300px";mckaylaDiv.style.right=0;mckaylaDiv.style.bottom=0;body.appendChild(mckaylaDiv) })();

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@mikedory
mikedory / fabfile.py
Last active December 15, 2015 08:08
A handy gist for deploying Django code to a remote server via Git/Fabric and then managing the app via Supervisor. Heavily inspired by the excellent docs at http://docs.fabfile.org/en/1.6/. Switch out the "appname" bits and everything in local_settings.py to suit your app's settings, naturally.
# import the fabric requirements
from __future__ import with_statement
from fabric.api import *
from fabric.contrib.console import confirm
# import local_settings.py
from local_settings import *
# run Django's test framework
def test():
@mikedory
mikedory / fabfile.py
Last active December 15, 2015 08:09
A *better* gist for deploying Django code to a remote server via Git/Fabric and then managing the app via Supervisor — this time with an option for tags and branches. Switch out the "appname" bits and everything in local_settings.py to suit your app's settings.
# import the fabric requirements
from __future__ import with_statement
from fabric.api import *
from fabric.contrib.console import confirm
# import local_settings.py
from gifhq.local_settings import *
"""