Skip to content

Instantly share code, notes, and snippets.

{
"england-and-wales": {
"division": "england-and-wales",
"events": [
{
"title": "Fake bank holiday",
"date": "2023-04-21",
"notes": "",
"bunting": true
}
@colinbm
colinbm / Contract Killer 3.md
Created January 22, 2018 22:00
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

@colinbm
colinbm / cloudflare_control.rb
Created September 9, 2014 09:42
Pause or resume all your CloudFlare sites at once. Useful if CloudFlare is misbehaving.
#!/usr/bin/env ruby
require 'cloudflare'
module CloudFlare
class Connection
public :send_req
end
end
@colinbm
colinbm / chgrp-www-data
Last active December 22, 2015 17:38
Allow any user to change the group of a file or directory within their home directory to www-data. Usage sudo chown-www-data <path>
#! /usr/bin/env ruby
require 'pathname'
require 'etc'
require 'shellwords'
path = ARGV.first
user = ENV['SUDO_USER']
SAFE_PATH_PREFIX = "/home/#{user}/"
@colinbm
colinbm / update_ctime.rb
Last active December 14, 2015 12:59
Correct the creationtime of photos based on EXIF data.
require 'exifr'
files = Dir['**/*']
files.each do |file|
if File.file?(file) && File.extname(file).downcase == '.jpg'
begin
exif = EXIFR::JPEG.new(file)
if !exif.date_time_original.nil?
File.utime(exif.date_time_original, exif.date_time_original, file)
@colinbm
colinbm / wpget.php
Created April 2, 2012 10:10
Class to wrap WordPress functions and return instead of echo
<?php
class WpGet {
public static function __callStatic($name, $args) {
if (function_exists($name)) {
ob_start();
$name($args);
$result = ob_get_contents();
ob_end_clean();
return $result;
@colinbm
colinbm / gist:1843685
Created February 16, 2012 09:44
wkhtmltopdf settings for print
For A3:
wkhtmltopdf --page-width 297 --page-height 420 --dpi 300 --margin-right 0 --margin-top 0 --margin-bottom 0 --margin-left 0 http://wktest.local ~/Desktop/wktest.pdf
body {
margin: 0;
padding: 0;
background: #ccc;
height: 420mm;
width: 297mm;
@colinbm
colinbm / crontab.txt
Created November 17, 2011 16:32
Quick reference header for all my crontabs - stolen/modified from wikipedia
# /───────────────────────── min (0 - 59)
# │ /──────────────────── hour (0 - 23)
# │ │ /─────────────── day of month (1 - 31)
# │ │ │ /────────── month (1 - 12)
# │ │ │ │ /───── day of week (0 - 7) (Sunday=0 or 7)
# │ │ │ │ │
# * * * * * command to be executed
@colinbm
colinbm / gist:1191441
Last active September 27, 2015 01:38
Banana, Dark Chocolate, & 5AM Saint Bread Cake
Banana, Dark Chocolate, & 5AM Saint Cake
See https://twitter.com/colinbm/status/110026973681684480
100 g wholemeal flour
130 g self raising flour
200 g sugar
1/2 tsp salt
1/2 tsp cinnamon
1/2 tsp baking powder