Skip to content

Instantly share code, notes, and snippets.

@davecranwell
davecranwell / data.json
Created March 19, 2016 23:50
nominetdata
{
"floors": [
{
"id": "1",
"name": "floor 1",
"desks": [
{
"id": "1",
"occupied": "1",
"last_occupied": "2016-03-18 12:34",
@davecranwell
davecranwell / responsive_image.py
Last active December 16, 2020 21:37
Responsive image tag for Wagtail CMS
from django import template
from django.template import Context
from django.template.base import parse_bits
from wagtail.wagtailimages.templatetags.wagtailimages_tags import ImageNode
from wagtail.wagtailimages.models import Filter, SourceImageIOError, InvalidFilterSpecError
from britishswimming.utils.models import SocialMediaSettings
register = template.Library()
@davecranwell
davecranwell / AppActions.js
Created May 1, 2015 13:46
React flux issue
/*
* Copyright (c) 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* TodoActions
*/
{
"version" : "1.2.3",
"url" : "https://wagtail.io"
}
Normal edit handlers:
--------------------
Am I an immediate child of a content_panel (or promote_panel etc)?
- Yes
- Am I a MultiFieldPanel or InlinePanel?
- Yes
- Output MultiFieldPanel/InlinePanel label as pink bar
- No (I'm a FieldPanel)
- Reuse field's own label as the pink title bar above,
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
# Base box to build off, and download URL for when it doesn't exist on the user's system already
config.vm.box = "wagtail-base-v0.1"
config.vm.box_url = "http://downloads.torchbox.com/wagtail-base-v0.1.box"
# You can also build from a vanilla precise32 box, although it'll take longer
@davecranwell
davecranwell / updatecore.sh
Last active December 11, 2015 23:08 — forked from zerolab/updatecore.sh
Updated to suit pressflow
#!/bin/bash
#
# Upgrades/Installs Pressflow (Drupal) core. Targeted at Pressflow 6
# Script based on gopressflow.sh
#
# Should be run from root folder of existing drupal installation
#
# * please backup your files before doing anything!
#
@davecranwell
davecranwell / gist:3551678
Created August 31, 2012 11:27
Not indented CSS
/* =============================================================================
Primary styles
========================================================================== */
/* ================ Sprites ================ */
.flag-mini{
float:left;
.image-replaces-text('layered/flags-mini.png', 27px, 27px);
}
@davecranwell
davecranwell / gist:3135759
Created July 18, 2012 11:51
Indented CSS
/* =============================================================================
Primary styles
========================================================================== */
/* ================ Sprites ================ */
.flag-mini{
float:left;
.image-replaces-text('layered/flags-mini.png', 27px, 27px);
}