Skip to content

Instantly share code, notes, and snippets.

View MattMS's full-sized avatar
🤔

Matt McKellar-Spence MattMS

🤔
View GitHub Profile
@MattMS
MattMS / Python_time_delta_from_text.py
Created August 28, 2015 05:13
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
MattMS / Django fixtures edit.py
Last active August 29, 2015 13:57
Django fixtures from JSON
"""
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
@MattMS
MattMS / keybase.md
Created July 7, 2014 13:51
keybase.md

Keybase proof

I hereby claim:

  • I am MattMS on github.
  • I am mattms (https://keybase.io/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
MattMS / PostgreSQL column names.sql
Last active August 29, 2015 14:07
Get column names from a PostgreSQL table
SELECT column_name FROM information_schema.columns WHERE table_name='my_table_name';
@MattMS
MattMS / _base.jade
Last active August 29, 2015 14:07
Jade base template with Markdown and CoffeeScript.
doctype html
html(lang="en")
head
meta(charset="utf-8")
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
body
block content
@MattMS
MattMS / Bootstrap 2 form.html
Last active August 29, 2015 14:08
Bootstrap 2 horizontal form
<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>
</div>
<div class="form-actions">
<button class="btn btn-primary" name="submit_btn" type="submit">Save changes</button>
@MattMS
MattMS / Python packages.sh
Last active August 29, 2015 14:13
My commonly used Python packages
pip install PyYAML
pip install requests
@MattMS
MattMS / Railo files.md
Created March 3, 2015 05:46
Notes on files used by Railo.

Railo files

tomcat/conf/server.xml

Seems to contain the main server configuration details.

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