Skip to content

Instantly share code, notes, and snippets.

View simoncoulton's full-sized avatar

Simon Coulton simoncoulton

View GitHub Profile

Keybase proof

I hereby claim:

  • I am simoncoulton on github.
  • I am simoncoulton (https://keybase.io/simoncoulton) on keybase.
  • I have a public key ASB7opHs1xGEkAbw3a6mwYCyGYx5ksdlZEiuADEdHhnTRAo

To claim this, I am signing this object:

@simoncoulton
simoncoulton / material-theme.itermcolors
Created July 13, 2015 06:05
Material-Theme iTerm2 Colors
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.19607843137254902</real>
<key>Green Component</key>
<real>0.16078431372549021</real>
@simoncoulton
simoncoulton / fun-with-flexbox.html
Last active August 29, 2015 14:21
Fun with Bourbon, Neat and my own flexbox based grid
<!doctype html>
<html>
<head>
<style>
img,legend{border:0}
legend,td,th{padding:0}
html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;box-sizing:border-box}
body{margin:0;text-rendering:optimizeLegibility}
article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}
audio,canvas,progress,video{display:inline-block;vertical-align:baseline}
@simoncoulton
simoncoulton / gist:427c8ed45055b485ae9b
Created February 24, 2015 03:04
console.log() always
(function (con) {
var method;
var dummy = function() {};
var methods = ('assert,count,debug,dir,dirxml,error,exception,group,' +
'groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,' +
'time,timeEnd,trace,warn').split(',');
while (method = methods.pop()) {
con[method] = con[method] || dummy;
}
})(window.console = window.console || {});
@simoncoulton
simoncoulton / pyvenv-3.4
Created August 1, 2014 01:34
Using pyvenv-3.4 on Trusty Tahr
# pyvenv fails as ensurepip is not available, the following will resolve that issue.
cd /tmp
wget https://www.python.org/ftp/python/3.4.1/Python-3.4.1.tgz
tar -xvzf Python-3.4.1.tgz
sudo cp -a Python-3.4.1/Lib/ensurepip/ /usr/lib/python3.4
# Now you're free to create your virtualenv
pyvenv-3.4 virtualenv_dir
@simoncoulton
simoncoulton / countries.py
Created February 12, 2014 04:00
List of countries with their 2 letter code
countries = [
('US', 'United States'),
('AF', 'Afghanistan'),
('AL', 'Albania'),
('DZ', 'Algeria'),
('AS', 'American Samoa'),
('AD', 'Andorra'),
('AO', 'Angola'),
('AI', 'Anguilla'),
('AQ', 'Antarctica'),
@simoncoulton
simoncoulton / gitkeep
Created January 8, 2014 05:42
Create empty gitkeep files in directories that are empty
find . -type d -empty -exec touch {}/.gitkeep \;
use Zend\Filter\Digits as DigitsFilter;
use Zend\Validator\AbstractValidator;
class Abn extends AbstractValidator
{
const INVALID = 'invalidAbn';
const DIGITS = 'digitsOnly';
const INCORRECT_LENGTH = 'lengthMismatch';
protected static $digitsFilter = null;
@simoncoulton
simoncoulton / nginx-uwsgi-python3
Created May 7, 2012 04:39
Setting up Nginx, uWSGI & Python3
======================================
Setting up Nginx, uWSGI and Python3
======================================
First off, I'm traditionally a PHP developer, but am looking at moving across to Python. I really struggled to find decent documentation on how to get a server up and running for deploying Python web applications from the point of view of someone coming from PHP. The main problems I came across with documentation were:
1) Only showed you how to run the server for a single web application.
2) Only showed you how to configure the app, not the server it was running on.
My preferred workflow for development is by setting up a new VM in VMware Fusion and then forwarding through all requests to that VM via /etc/hosts. This might not be the optimal way to get things up and running, but it works for me.