Skip to content

Instantly share code, notes, and snippets.

View thclark's full-sized avatar

Tom Clark thclark

View GitHub Profile
@thclark
thclark / Backend Case Study.md
Last active April 29, 2024 09:28
A gist describing the backend developer case study for hiring python backend engineers

Backend Developer Case Study

HI POTENTIAL BACKEND DEVELOPERS!

I'm Tom, I run development of the WindQuest webapp. If we end up working together, I'll be responsible for mentoring and training you as well as overseeing your work on WindQuest and similar applications within WindPioneers.

Right now, if you're willing, I'd like you to complete a small case study so I can get a sense of where your skill level is at. We hire quite broadly from Very Junior to Super Senior so it's OK to be wherever you're at right now!

At WindPioneers and our partner company Octue.com, we're keen on helping our employees and candidates improve themselves continually. With that in mind, I've designed this case study so that most developers (regardless of skill level) can learn things while doing it - put a little time in and you'll come out of the other side a better developer.

@thclark
thclark / blocks.py
Created May 23, 2019 19:18
Wagtail serializers for streamfield - example of customizing per-block
class HeroBlock(StructBlock):
content = StreamBlock([
('button', StructBlock([
('text', CharBlock(required=False, max_length=80, label='Label')),
('url', URLBlock(required=False, label='URL')),
], label='Call to action', help_text='A "call-to-action" button, like "Sign Up Now!"')),
('video', EmbedBlock(label='Video')),
('quote', StructBlock([
('text', TextBlock()),
@thclark
thclark / sketch.yml
Created March 17, 2022 12:57
Sketch of what a set of octue github actions would look like
name: octue
on:
push:
branches:
- main
pull_request:
branches:
- main
@thclark
thclark / UserSnap.jsx
Created January 5, 2022 11:57
UserSnap in react or gatsby
import React from 'react'
import { Helmet } from 'react-helmet'
// Replace with the API keys from your widget installation page
const USERSNAP_GLOBAL_API_KEY = '<YOUR_USERSNAP_GLOBAL_API_KEY>'
/* Render this anywhere in your tree (preferably at the top of your app) to invoke the usersnap widget.
*/
const UserSnap = () => {
return (
@thclark
thclark / dataProvider.js
Created October 18, 2019 08:11
A django dataProvider for react-admin v3.x
import { stringify } from 'query-string'
import { fetchUtils } from 'react-admin'
import Cookies from 'universal-cookie'
import { store } from 'index'
const camelCaseKeys = require('camelcase-keys')
const snakeCaseKeys = require('snakecase-keys')
@thclark
thclark / stack_mixin.py
Created October 27, 2021 14:32
Stack Printing Mixin
class StackMixin:
""" A mixin to print out methods as they're called on classes.
Mix this in to classes whose logic flow you're trying to analyse, and you'll get a clear print out
of what methods are called and when.
"""
def __getattribute__(self, attr):
method = object.__getattribute__(self, attr)
@thclark
thclark / gtest.rb
Last active March 11, 2020 10:00 — forked from Kronuz/gtest.rb
Homebrew Formula for Google Test
# Homebrew Formula for Google Test
# Usage: brew install --HEAD https://gist.githubusercontent.com/Kronuz/96ac10fbd8472eb1e7566d740c4034f8/raw/gtest.rb
require 'formula'
class Gtest < Formula
desc "Google Test"
homepage "https://github.com/google/googletest"
head "git://github.com/google/googletest.git", :using => :git
@thclark
thclark / heroku_local.sh
Created December 6, 2019 10:28
Running celery, flower and heroku locally for a django app
#!/usr/bin/env bash
export PYTHONUNBUFFERED=1
export DJANGO_READ_DOT_ENV_FILE=1
export DJANGO_SETTINGS_MODULE=backend.settings.local
heroku local -p 8000
@thclark
thclark / # osgeo-gdal - 2019-12-04_16-57-56.txt
Created December 4, 2019 17:02
osgeo-gdal (osgeo/osgeo4mac/osgeo-gdal) on macOS 10.14.6 - Homebrew build logs
Homebrew build logs for osgeo/osgeo4mac/osgeo-gdal on macOS 10.14.6
Build date: 2019-12-04 16:57:56
@thclark
thclark / FullArea.js
Created February 21, 2019 22:34
React HOC that places children in a div the size of the remaining window space. Updates on window resize. More info at https://stackoverflow.com/a/54112855/3556110
import React, { Component } from 'react'
import PropTypes from 'prop-types'
class FullArea extends Component {
constructor(props) {
super(props)
this.state = {
width: 0,
height: 0,