Skip to content

Instantly share code, notes, and snippets.

@adamphillips
adamphillips / .vimrc
Last active January 18, 2022 13:57
Example .vimrc
syntax on
filetype plugin on
" Enable autocomplete
set ofu=syntaxcomplete#Complete
" General defaults
" ===================
set expandtab " use spaces for tabs
@adamphillips
adamphillips / uk.co.29ways.outlook-cleanup.plist
Last active January 22, 2020 17:23
Outlook Cleanup - plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>uk.co.29ways.outlook-cleanup</string>
<key>ProgramArguments</key>
<array>
<string>osascript</string>
@adamphillips
adamphillips / outlook-cleanup.scpt
Last active January 22, 2020 17:23
Outlook Cleanup - Step 2
# Some initial variables
set today to (current date)
set cutoff to 2 * days
set shortCutoff to 3 * hours
tell application "Microsoft Outlook"
set myInbox to folder "Inbox" of default account
set archive to folder "Archive" of default account
set theMessages to messages of inbox
@adamphillips
adamphillips / outlook-cleanup.scpt
Last active January 22, 2020 17:23
Outlook Cleanup - Step 1
tell application "Microsoft Outlook"
set myInbox to folder "Inbox" of default account
set theMessages to messages of inbox
repeat with theMessage in theMessages
try
# rules will go here
on error errorMsg
log "Error: " & errorMsg
end try
class FairSummaryJson
def initialize(fair, options={})
@cash_report_url = options.fetch(:cash_report_url) { '' }
end
def to_hash
{
id: fair.id,
school: SchoolSummaryJson.new(fair.school).to_hash
cash_report_url: cash_report_url
@adamphillips
adamphillips / gist:33c83c56a2e06c25eed1
Created May 21, 2014 22:41
PS3 controller Gosu button constants
# After pairing a PS3 Controller on OSX to use with Gosu, this is how Gosu
# recognises the different controller actions
# Left Stick
GpUp, GpDown, GpLeft, GpRight
# Right Stick (doesn't recognise up and down)
GpLeft, GpRight
GpButton1 # Left Stick press
From 2441910d94cad6e15b8f859369b8242022d7ca4e Mon Sep 17 00:00:00 2001
From: Adam Phillips <aphillips@scholastic.co.uk>
Date: Wed, 5 Mar 2014 23:10:33 +0000
Subject: [PATCH] Change Rails dependency to 3.1
---
activeadmin-cms.gemspec | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/activeadmin-cms.gemspec b/activeadmin-cms.gemspec
@adamphillips
adamphillips / benchmark_url
Last active May 29, 2019 10:48
A quick and dirty url benchmarking script. Needs a chmod +x. Alternatively just run it with ruby
#!/usr/bin/env ruby
# Used to perform multiple requests of urls for benchmarking
#
# @example
# # Requests the url 3 times outputting times for each
# ./benchmark_url 3 http://my.url.com
# ruby benchmark_url 3 http://my.url.com
#
# # Requests each url 5 times outputting times for each
From 363260815f1a5812d659c6d865ab884b20d46167 Mon Sep 17 00:00:00 2001
From: Adam Phillips <aphillips@scholastic.co.uk>
Date: Thu, 6 Jun 2013 14:15:31 +0100
Subject: [PATCH] Bug 3011: Tell a friend failing to hide the spam trap
There are two parts to this - the spam trap was not being hidden due to missing
CSS and then was erroring on submit as it was missing some code to check how
much time had passed between the initial get request and the post request.
For the first part, the CSS was removed accidentally in commit 62727113a63e0
From 713527f239f58ab21a40226e2816176c93152d50 Mon Sep 17 00:00:00 2001
From: Adam Phillips <aphillips@scholastic.co.uk>
Date: Mon, 11 Mar 2013 09:56:50 +0000
Subject: [PATCH 1/2] Rejigged existing CSE search controller tests
Rejigged the existing tests into the new format before updating them to
remove bookfairs and writers.
---
.../test/functional/cse_search_controller_test.rb | 119 ++++++++++++---------
1 file changed, 68 insertions(+), 51 deletions(-)