Skip to content

Instantly share code, notes, and snippets.

View harry-wood's full-sized avatar
💭
(I've a separate github account for work)

Harry Wood harry-wood

💭
(I've a separate github account for work)
View GitHub Profile
@harry-wood
harry-wood / fluxbb-bbcode.txt
Created November 7, 2022 20:23
BBCode syntax examples
[h]Fluxbb bbcode tests[/h]
[h]Text[/h]
[b]Bold text[/b]
[u]Underlined text[/u]
[i]Italic text[/i]
@harry-wood
harry-wood / installing libxml on mac for ruby.md
Last active May 25, 2024 17:50
Installing libxml on mac for ruby.md

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
<?php /*template name: Export*/
if ( !is_user_logged_in() ) {
auth_redirect();
}
$admin_user = current_user_can('manage_options');
if (!$admin_user) die("ACCESS DENIED");
if (isset($_GET['export'])) {
$table_head = array('column1', 'column2', 'column3');
@harry-wood
harry-wood / linear-time-calculator.html
Created August 16, 2020 02:43
Linear Time Calculator
<html>
<head>
<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">
<style>
body {
background: WHITE;
font-family: Verdana, Helvetica, Arial, sans-serif;
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@harry-wood
harry-wood / actionmailer-test.rb
Created March 3, 2020 10:36
ActionMailer test
class TestMailer < ActionMailer::Base
default from: "test@gmail.com"
def test_mail
mail(
to: "Harry Wood <test@gmail.com>",
subject: "Testing mail sending",
from: "test@gmail.com",
content_type: "text/html",
) do |format|
@harry-wood
harry-wood / inone.rb
Created September 13, 2018 13:29
Spit out any lines which are in the first file and not in the second
#!/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 = File.open(ARGV[0])
fb = File.open(ARGV[1])
linea = nil
lineb = nil
@harry-wood
harry-wood / holidays.rb
Created December 5, 2017 12:14
That thing when you write a ruby script to calculate holiday days :-)
require 'date'
DAY_NAMES = %w[Sun Mon Tue Wed Thu Fri Sat].freeze
BANK_HOLIDAYS = [
Date.new(2017, 1, 2),
Date.new(2017, 4, 14),
Date.new(2017, 4, 17),
Date.new(2017, 5, 1),
Date.new(2017, 5, 29),
@harry-wood
harry-wood / random_kml.rb
Created October 16, 2017 00:35
Little ruby script to generate a test KML file, with 40 random markers
puts '<?xml version="1.0" encoding="UTF-8"?>'
puts '<kml xmlns="http://www.opengis.net/kml/2.2">'
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
harry-wood / Vagrantfile for jekyll
Last active January 3, 2017 15:58
Vagrantfile for jekyll (ruby2 rbenv bundle-installed project)
Vagrant::Config.run do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.forward_port 4000, 4000
$script = <<-SCRIPT
set -o verbose
set -e
whoami