November 2020

May 2020

  • Tailwind CSS + Hugo | Step 3 – Adding some basic content.

    I added some basic content to the site index page tonight.

    I don’t want to design the layout in isolation from the content. Real content allows me to do this piece by piece, and gives me some confidence in my approach.

    It keeps me grounded to one of the reasons for doing this in the first place.

    Read on and see how I added the basic content, and what I’m going to do in step 4.

    Continue reading …

April 2020

  • Tailwind CSS + Hugo | Step 2 – Create a Basic Layout

    It’s been a while since Step 1 but I’ve finally come back to have a little further exploration with Tailwind.

    After Step 1, I had a very very basic site in place, so I decided it’s time to create a basic layout.

    I’ve decided not to be very adventurous to start-out, and so I stick with the single column layout I currently have on the site, along with three main sections of content.

    Continue reading …

  • Release: pathfinder 0.6.2

    Pathfinder 0.6.2 is a minor release, with a fix that requires the filepath parameter to exist.

    If the path does not exist an error is raised.

February 2020

January 2020

  • Testing with pendulum

    My usual way of modifying the behaviour of pendulum.now() when testing has been to mock it:

    with mock.patch(
        "pendulum.now", return_value=pendulum.parse("2020-01-01 00:00:00")
    ):
      ...
    

    However, I did something mad today, and delved into the docs and found a neater way:

    with pendulum.test(pendulum.parse("2020-01-01 00:00:00")):
    

January 2019

October 2018

January 2018

December 2017

February 2017

  • python-intercom 3.0

    Version 3 of python-intercom has risen from it’s seat in the basement, stomped up the stairs, burst through the front door, and roared “I’M FREE!".

November 2016

September 2016

January 2016

December 2015

August 2015

  • baseliner 1.0.beta

    Baseliner has reverted to client side overlay generation. The main reason for this change, is to allow Baseliner to work offline. I felt that this simple tool should not need an internet connection to work.
  • python-intercom 2.1.1

    Announcing version 2.1.1 of python-intercom.
  • Keybase Web Identity Alert

    Having a proven web identity on Keybase provides a very basic sanity check for a web site. I recently broke the deployment to this site, and it was an email from Keybase that first alerted me.

July 2015

May 2015

April 2015

  • python-intercom 2.0.beta

    A couple of major issues were raised for the alpha release. The first was the lack of support for empty body responses, and the second was incorrect tracking of changed_attributes for resources.

    These are fixed in this release, and an FAQ has been added to the documentation.

March 2015

September 2014

August 2014

November 2013

September 2013

August 2013

June 2013

May 2013

April 2013

March 2013

  • Release: python-intercom 0.2.7

  • WIP: Python Markdown prettypre extension

        <span class="k">def</span> <span class="nf">extendMarkdown</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">md</span><span class="p">,</span> <span class="n">md_globals</span><span class="p">)</span><span class="p">:</span>
            <span class="n">md</span><span class="o">.</span><span class="n">registerExtension</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">processor</span> <span class="o">=</span> <span class="n">PreTreeprocessor</span><span class="p">(</span><span class="p">)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">processor</span><span class="o">.</span><span class="n">md</span> <span class="o">=</span> <span class="n">md</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">processor</span><span class="o">.</span><span class="n">config</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">getConfigs</span><span class="p">(</span><span class="p">)</span><span class="o">&lt;</span><span class="o">/</span><span class="n">pre</span><span class="o">&gt;</span></code></pre></div>
    
    <span class="k">def</span> <span class="nf">extendMarkdown</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">md</span><span class="p">,</span> <span class="n">md_globals</span><span class="p">)</span><span class="p">:</span>
        <span class="n">md</span><span class="o">.</span><span class="n">registerExtension</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">processor</span> <span class="o">=</span> <span class="n">PreTreeprocessor</span><span class="p">(</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">processor</span><span class="o">.</span><span class="n">md</span> <span class="o">=</span> <span class="n">md</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">processor</span><span class="o">.</span><span class="n">config</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">getConfigs</span><span class="p">(</span><span class="p">)</span>
    

    </code></pre>

  • Typeform

December 2012

November 2012

October 2012

  • codepad.org

  • Django TestCase Transaction Wrapping

    def disable_transaction_methods(): from django.test.testcases import disable_transaction_methods

    <span class="k">for</span> <span class="n">db</span> <span class="ow">in</span> <span class="n">connections</span><span class="p">:</span>
        <span class="n">transaction</span><span class="o">.</span><span class="n">enter_transaction_management</span><span class="p">(</span><span class="n">using</span><span class="o">=</span><span class="n">db</span><span class="p">)</span>
        <span class="n">transaction</span><span class="o">.</span><span class="n">managed</span><span class="p">(</span><span class="bp">True</span><span class="p">,</span> <span class="n">using</span><span class="o">=</span><span class="n">db</span><span class="p">)</span>
    <span class="n">disable_transaction_methods</span><span class="p">(</span><span class="p">)</span>
    

    def restore_transaction_methods(): from django.test.testcases import restore_transaction_methods

    <span class="n">restore_transaction_methods</span><span class="p">(</span><span class="p">)</span>
    <span class="k">for</span> <span class="n">db</span> <span class="ow">in</span> <span class="n">connections</span><span class="p">:</span>
        <span class="n">transaction</span><span class="o">.</span><span class="n">rollback</span><span class="p">(</span><span class="n">using</span><span class="o">=</span><span class="n">db</span><span class="p">)</span>
        <span class="n">transaction</span><span class="o">.</span><span class="n">leave_transaction_management</span><span class="p">(</span><span class="n">using</span><span class="o">=</span><span class="n">db</span><span class="p">)</span><span class="o">&lt;</span><span class="o">/</span><span class="n">pre</span><span class="o">&gt;</span></code></pre></div>
    

    from unittest import TestCase

    class Test(TestCase):

    <span class="nd">@classmethod</span>
    <span class="k">def</span> <span class="nf">class_setup</span><span class="p">(</span><span class="bp">cls</span><span class="p">)</span><span class="p">:</span>
        <span class="n">disable_transaction_methods</span><span class="p">(</span><span class="p">)</span>
        <span class="c1"># ... import test fixtures</span>
    
    <span class="nd">@classmethod</span>
    <span class="k">def</span> <span class="nf">class_teardown</span><span class="p">(</span><span class="bp">cls</span><span class="p">)</span><span class="p">:</span>
        <span class="n">restore_transaction_methods</span><span class="p">(</span><span class="p">)</span>
    
    <span class="k">def</span> <span class="nf">test_data_attributes</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span><span class="p">:</span>
        <span class="c1"># ...</span>
    
    <span class="k">def</span> <span class="nf">test_class_properties</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span><span class="p">:</span>
        <span class="c1"># ...</span></code></pre></div>
    

May 2012

March 2012

December 2011

November 2011

October 2011

September 2011

August 2011

July 2011

June 2011

May 2011

March 2011

February 2011

January 2011

December 2010

November 2010

October 2010

September 2010

August 2010

July 2010

June 2010

May 2010

April 2010

  • Shutdown and restart (automated dev env setup)

    if [ $# -ne 1 ]; then PATHDIR=</span><span class="nb">pwd</span><span class="sb"> else PATHDIR=$1 fi

    /usr/bin/osascript > /dev/null &lt;&lt;-EOF activate application "Terminal" tell application "System Events" keystroke "t" using {command down} end tell tell application "Terminal" repeat with win in windows try if get frontmost of win is true then do script "cd $PATHDIR; clear" in (selected tab of win) end if end try end repeat end tell EOF

    # get the directory this script was launched from bindir=</span>dirname <span class="nv">$0</span><span class="sb">

    # open TextMate $bindir/termexec "cd $PATHDIR" $bindir/termexec "mate ."

    $bindir/newtab $PATHDIR # for svn, git, etc.

    # start Apache $bindir/newtab $PATHDIR $bindir/termexec "httpd -k restart -f $PATHDIR/dev_conf/localhost.conf"

    # start PostgreSQL $bindir/newtab $PATHDIR # for postgres $bindir/termexec "$PATHDIR/bin/postgresql start"

    # open Firefox open $FIREFOX –args $APP_URL

    export FIREFOX APP_URL

    bindir=</span>dirname <span class="nv">$0</span><span class="sb">

    $bindir/devapps "/Users/john/Workspace/demo/jobs"

  • Google Follow Finder

  • GitHub Gists

  • Football updates on the mobile web