Skip to content

Instantly share code, notes, and snippets.

@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 / 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|
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 / 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;
}
<?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 / 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 April 9, 2023 17:04
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