Skip to content

Instantly share code, notes, and snippets.

@alexhayes
alexhayes / australian-postcodes.sql
Created October 19, 2015 04:10 — forked from randomecho/australian-postcodes.sql
Australian postcodes (with states and suburb names) geocoded with latitude and longitude.
/*
Taken and cribbed from blog.datalicious.com/free-download-all-australian-postcodes-geocod
May contain errors where latitude and longitude are off. Use at own non-validated risk.
*/
SET NAMES utf8;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP TABLE IF EXISTS postcodes_geo;
@alexhayes
alexhayes / ReactPureRenderMixinInES6.jsx
Created November 10, 2015 11:32
react-addons-pure-render-mixin using ES6 classes in React
import React from 'react'
import {shouldComponentUpdate} from 'react-addons-pure-render-mixin'
export default class extends React.Component {
shouldComponentUpdate = shouldComponentUpdate
static propTypes ={
disabled: React.PropTypes.bool,
}
}
@alexhayes
alexhayes / Force All Email Delivery To A Single Email Address.rst
Last active December 8, 2015 00:27
Force all email delivery in Ubuntu to a particular address

Force All Email Delivery To A Single Email Address

So, you're a developer testing lots of codes and you want to ensure that you don't accidentally send out email to people during testing.

However, you also want to actually view emails in a real email client, not a console.

This is how you can do it using Ubuntu and Exim ensuring that the email gets sent out through Google apps.

class OrderedDictSerializer(serializers.ListSerializer):
"""
django-rest-framework serializer that a list or queryset into an OrderedDict.
"""
def to_representation(self, data):
"""
OrderedDict of object instances -> OrderedDict of dicts of primitive datatypes.
"""
# Dealing with nested relationships, data can be a Manager,
@alexhayes
alexhayes / Reaper DDP Creation, Verification & Burn.rst
Last active December 11, 2022 06:08
Reaper DDP Creation, Verification and Burn Instructions.

DDP Creation, Verification & Burn

DDP creation, verification & burn using Reaper, ddpinfo and ImgBurn.

Reaper

TLDR

@alexhayes
alexhayes / dumpnested.py
Created May 2, 2016 08:37
Django management command to dump objects to JSON with all nested relations included.
# -*- coding: utf-8 -*-
"""
Dump out objects and all nested associations.
"""
from __future__ import absolute_import, print_function, unicode_literals
import sys
from django.contrib.admin.utils import NestedObjects
from django.core import serializers
@alexhayes
alexhayes / dumpdata_by_id.py
Last active July 4, 2016 00:29
Django management command to dump out model instances and all nested associations
# -*- coding: utf-8 -*-
"""
Dump out objects and all nested associations.
"""
from __future__ import absolute_import, print_function, unicode_literals
import sys
from django.contrib.admin.utils import NestedObjects
from django.core import serializers
@alexhayes
alexhayes / npm-standalone-eslint-install.sh
Last active July 12, 2016 03:05
Standalone `npm` install for eslint/react/et al
#!/bin/bash
npm install -g eslint babel-eslint eslint-config-standard-react eslint-config-standard eslint-plugin-promise eslint-plugin-standard eslint-config-standard eslint-plugin-flow-vars eslint-plugin-react
@alexhayes
alexhayes / keybase.md
Created August 31, 2016 22:00
keybase.md

Keybase proof

I hereby claim:

  • I am alexhayes on github.
  • I am alexhayes (https://keybase.io/alexhayes) on keybase.
  • I have a public key whose fingerprint is 39B2 DA8A 524D 2835 5D99 6460 217F 3346 CF5D B9E9

To claim this, I am signing this object:

@alexhayes
alexhayes / pyenv+direnv on OSX.md
Last active November 6, 2022 20:17
Awesomely easy virtualenvs on OSX using pyenv and direnv

Awesomely easy virtualenvs on OSX using pyenv and direnv

Never forget to activate that virtualenv or set that environment variable ever again...

Install

  1. Install pyenv

     brew install pyenv