Skip to content

Instantly share code, notes, and snippets.

harry-wood / fluxbb-bbcode.txt
Created Nov 7, 2022
BBCode syntax examples
View fluxbb-bbcode.txt
[h]Fluxbb bbcode tests[/h]
[b]Bold text[/b]
[u]Underlined text[/u]
[i]Italic text[/i]
harry-wood / installing libxml on mac for
Last active Sep 28, 2022
Installing libxml on mac for
View installing libxml on mac for

Installing/debugging libxml on mac for ruby/rails

Install xcode command line tools (or check if they're already installed)

xcode-select --install

Do we have libxml installed already?

xsltproc --version
View Wordpress template for CSV export
<?php /*template name: Export*/
if ( !is_user_logged_in() ) {
$admin_user = current_user_can('manage_options');
if (!$admin_user) die("ACCESS DENIED");
if (isset($_GET['export'])) {
$table_head = array('column1', 'column2', 'column3');
View linear-time-calculator.html
<title>Linear time calculator</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
body {
background: WHITE;
font-family: Verdana, Helvetica, Arial, sans-serif;
View london-wards.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View actionmailer-test.rb
class TestMailer < ActionMailer::Base
default from: ""
def test_mail
to: "Harry Wood <>",
subject: "Testing mail sending",
from: "",
content_type: "text/html",
) do |format|
harry-wood / inone.rb
Created Sep 13, 2018
Spit out any lines which are in the first file and not in the second
View inone.rb
#!/usr/local/bin/ruby -w
# Assuming the two files are sorted, this will walk through them in parallel comparing
# and spitting out any lines which are in the first one and not in the second.
# its equivalend to the unix command: diff A.txt B.txt|grep '^<'|awk '{print $2}'
fa =[0])
fb =[1])
linea = nil
lineb = nil
harry-wood / holidays.rb
Created Dec 5, 2017
That thing when you write a ruby script to calculate holiday days :-)
View holidays.rb
require 'date'
DAY_NAMES = %w[Sun Mon Tue Wed Thu Fri Sat].freeze
BANK_HOLIDAYS = [, 1, 2),, 4, 14),, 4, 17),, 5, 1),, 5, 29),
harry-wood / random_kml.rb
Created Oct 16, 2017
Little ruby script to generate a test KML file, with 40 random markers
View random_kml.rb
puts '<?xml version="1.0" encoding="UTF-8"?>'
puts '<kml xmlns="">'
puts '<Document>'
puts " <name>Lots of placemarks #{random_str}</name>"
puts ' <description>A test KML file with lots of placemarks</description>'
(0..40).each do
puts '<Placemark>'
puts " <name>placemark name #{random_str}</name>"
puts " <description>#{random_str}#{random_str}#{random_str}</description>"
harry-wood / Vagrantfile for jekyll
Last active Jan 3, 2017
Vagrantfile for jekyll (ruby2 rbenv bundle-installed project)
View Vagrantfile for jekyll do |config| = "ubuntu/trusty64"
config.vm.forward_port 4000, 4000
$script = <<-SCRIPT
set -o verbose
set -e