Skip to content

Instantly share code, notes, and snippets.


Matt McKellar-Spence MattMS

View GitHub Profile
MattMS /
Created Aug 28, 2015
Create a Python timedelta from text.
from datetime import timedelta
import logging
logger = logging.getLogger(__name__)
def get_time_delta_from_text(text):
kwargs = dict()
for pair in text.split(','):
name, sep, value = pair.partition('=')
MattMS / Django fixtures
Last active Aug 29, 2015
Django fixtures from JSON
View Django fixtures
Simple operations for editing JSON Django fixtures.
These functions may be useful as example code for manipulating a JSON
file so it plays nice as a Django fixture.
import json

Keybase proof

I hereby claim:

  • I am MattMS on github.
  • I am mattms ( on keybase.
  • I have a public key whose fingerprint is CA2E 955C 7241 A555 F222 BC00 F4B6 A42B 4690 0CD9

To claim this, I am signing this object:

MattMS / PostgreSQL column names.sql
Last active Aug 29, 2015
Get column names from a PostgreSQL table
View PostgreSQL column names.sql
SELECT column_name FROM information_schema.columns WHERE table_name='my_table_name';
MattMS / _base.jade
Last active Aug 29, 2015
Jade base template with Markdown and CoffeeScript.
View _base.jade
doctype html
meta(http-equiv="X-UA-Compatible", content="IE=edge")
meta(name="viewport", content="width=device-width, initial-scale=1.0, user-scalable=no")
title This is Jade
block content
MattMS / Bootstrap 2 form.html
Last active Aug 29, 2015
Bootstrap 2 horizontal form
View Bootstrap 2 form.html
<form class="form-horizontal" method="post">
<div class="control-group">
<label class="control-label" for="email_inp">Email</label>
<div class="controls">
<input id="email_inp" name="email" placeholder="Email" type="text">
<span class="help-block">Please enter a valid email address.</span>
<div class="form-actions">
<button class="btn btn-primary" name="submit_btn" type="submit">Save changes</button>
MattMS / Python
Last active Aug 29, 2015
My commonly used Python packages
View Python
pip install PyYAML
pip install requests
MattMS / Railo
Created Mar 3, 2015
Notes on files used by Railo.
View Railo

Railo files


Seems to contain the main server configuration details.

MattMS / logging
Last active Aug 29, 2015
Get logging level from argparse
View logging
import argparse
import logging
logger = logging.getLogger(__name__)
kwargs = dict(level=logging.INFO)
if '__main__' == __name__:
parser = argparse.ArgumentParser(description='')
MattMS / HTML document
Last active Aug 29, 2015
HTML document ready event
View HTML document
document.addEventListener 'DOMContentLoaded', (event)->