Skip to content

Instantly share code, notes, and snippets.

from unittest import TestCase
class TestThing(TestCase):
def setUp(self):
self.thing = do_a_thing()
def test_foo(self):
self.assertEqual(self.thing.foo, 'bar')
@markpasc
markpasc / data.py
Created September 7, 2011 01:14
Display IPv4 addresses as funny phrases
FIRST_NAMES = """
JAMES
JOHN
ROBERT
MICHAEL
WILLIAM
DAVID
RICHARD
CHARLES
JOSEPH
@markpasc
markpasc / gist:996696
Created May 28, 2011 07:42
git-destroy
#!/bin/sh
UPDATE="git update-index --remove $@"
echo "git filter-branch --prune-empty -f --index-filter '$UPDATE' HEAD"
git filter-branch --prune-empty -f --index-filter "$UPDATE" HEAD
@markpasc
markpasc / ordertest.tmpl
Created May 27, 2011 04:46
patch to add an mt:OrderDate tag that honors date contexts
diff --git a/plugins/Order/config.yaml b/plugins/Order/config.yaml
index 46181f2..f4da46d 100644
--- a/plugins/Order/config.yaml
+++ b/plugins/Order/config.yaml
@@ -14,3 +14,5 @@ tags:
OrderFooter: $Order::Order::Plugin::tag_order_footer
OrderDateHeader: $Order::Order::Plugin::tag_order_date_header
OrderDateFooter: $Order::Order::Plugin::tag_order_date_footer
+ function:
+ OrderDate: $Core::MT::Template::Context::_hdlr_date
@markpasc
markpasc / diamond.py
Created May 13, 2011 19:29
python diamond inheritance works
class Base(object):
def data(self):
return {'base': True}
class A(Base):
def data(self):
data = super(A, self).data()
data.update({'a': True})
return data
@markpasc
markpasc / gist:963411
Created May 9, 2011 21:06
mt-Order with date headers/footers if mt:orderitem supported OrderDateHeader and Footer tags that it doesn't
<mt:Order>
<mt:OrderHeader>
<div class="site-activity">
</mt:OrderHeader>
<mt:OrderDateHeader>
<h2><mt:Date format="%a, %d %b %Y"></h2>
<div id="datebox">
</mt:OrderDateHeader>
@markpasc
markpasc / gist:948750
Created April 29, 2011 18:17
mt-Order with date headers/footers if mt:orderitem supported a “unique” attribute that it doesn't
<mt:Order>
<mt:OrderHeader>
<div class="site-activity">
</mt:OrderHeader>
<mt:Entries>
<mt:DateHeader>
<mt:OrderItem unique="true">
@markpasc
markpasc / example
Created March 23, 2011 18:41
ytf: describe a YouTube video from the command line
markpasc@markpascbook:~$ ytf http://www.youtube.com/watch?v=bWBbt--UUP8
IT'S CAT-ERTAINMENT! (3:29)
Posted 2011-03-22 by BargainBinofOblivion to 5801 views
www.everythingisterrible.com
markpasc@markpascbook:~$ yt http://youtu.be/rTUwqxHpXMY
Android on crack..lol (2:25)
Posted 2011-03-21 by dark32 to 155718 views
@markpasc
markpasc / hoo.py
Created January 5, 2011 00:02 — forked from sekimura/gist:765587
#!/usr/bin/env python
from subprocess import call
import time
ho = 'h'
def ooer():
while True:
for i in range(6):
yield 'o'
yield '-o'
@markpasc
markpasc / get_request.txt
Created November 15, 2010 19:02
TypePad OAuth Authorization header in protected resource requests
GET /users/@self.json HTTP/1.0
Host: api.typepad.com
Authorization: OAuth realm="", oauth_nonce="95331075", oauth_timestamp="1289847587", oauth_consumer_key="649e9c735a549ead", oauth_signature_method="HMAC-SHA1", oauth_version="1.0", oauth_token="lNE79f2DGUGSzaqB", oauth_signature="Fvo3W7X8It6b8xeR9SacmUfsWKI%3D"