Skip to content

Instantly share code, notes, and snippets.

View willtonkin's full-sized avatar
💭
I may be slow to respond.

Will Tonkin willtonkin

💭
I may be slow to respond.
View GitHub Profile
@willtonkin
willtonkin / fix-dropbox-conflicts.sh
Created January 13, 2014 10:14
Something quick and nasty I used to fix a strange sync collision I had in Dropbox. The strings to change should be self explanatory. Tested in a Git repo I was working on so certain this works well.
#!/bin/bash
while IFS= read -r -d $'\0' file; do
dirname="${file%/*}/"
basename="${file:${#dirname}}"
removeme=" (Wills-MacBook-Pro's conflicted copy 2013-12-05)"
newname="${basename/$removeme/}"
mv -f "$file" "$dirname$newname"
done < <(find . -name "*conflicted\ copy\ 2013-12-05*" -type f -print0)
@willtonkin
willtonkin / contact-csv-output.html
Created January 24, 2014 21:20
ExpressionEngine template that creates a CSV file from FreeForm data.
"First Name","Email"
{exp:freeform:entries
form_name="contact"
orderby="entry_date"
sort="asc"
limit="9999"
}"{freeform:field:first_name}","{freeform:field:email}"
{/exp:freeform:entries}
<?php
Set up your file structure for the innerParsys component:
innerParsys
-> parsys
-> new
- _cq_editConfig.xml
- .content.xml
- _cq_editConfig.xml
- .content.xml
- parsys.jsp
@willtonkin
willtonkin / bmi.js
Created November 24, 2014 22:16
The JS injected into pages served over O2 and Vodafone 3G/4G connections. This is worth being aware of as it's broken sites I've worked on in the past.
var bmi_htmlEdit=0;var bmi_ie;var bmi_ns;var bmi_safari;var bmi_imageObjSelected;var bmi_ffx_op_toolTip="Shift+R improves the quality of this image. Shift+A improves the quality of all images on this page.";var bmi_toolTip="Shift+R improves the quality of this image. CTRL+F5 reloads the whole page.";var bmi_ns_tooltip="Shift+Reload reloads the whole page.";var bmi_toolTipSeperator=" ... ";var bmi_concatStr="bmi_orig_img";var bmi_frameNotAllowed;var agt=navigator.userAgent.toLowerCase();var is_major=parseInt(navigator.appVersion);var is_minor=parseFloat(navigator.appVersion);var bmi_ns=((agt.indexOf('mozilla')!=-1)&&(agt.indexOf('spoofer')==-1)&&(agt.indexOf('compatible')==-1)&&(agt.indexOf('opera')==-1)&&(agt.indexOf('webtv')==-1)&&(agt.indexOf('hotjava')==-1));var bmi_ns2=(bmi_ns&&(is_major==2));var bmi_ns3=(bmi_ns&&(is_major==3));var bmi_ns4=(bmi_ns&&(is_major==4));var bmi_ns4up=(bmi_ns&&(is_major>=4));var bmi_nsonly=(bmi_ns&&((agt.indexOf(";nav")!=-1)||(agt.indexOf("; nav")!=-1)||(agt.indexOf("Netscape")!=
// Filter search to only show post type of post
function SearchFilter($query) {
if ($query->is_search) {
$query->set('post_type', 'post');
}
return $query;
}
add_filter('pre_get_posts','SearchFilter');
@willtonkin
willtonkin / gist:80ef7b83249ee367236c
Created May 15, 2015 10:14
Adobe Search&Promote Crawl Title Rules Examples
# Remove site title (all after the pipe character) from captured page title
RewriteRule ^(.*)[[:blank:]]\|[[:blank:]](.*)$ ${$1}
@willtonkin
willtonkin / keybase.md
Created May 26, 2015 15:40
my Keybase proof of ownership

Keybase proof

I hereby claim:

  • I am willtonkin on github.
  • I am willtonkin (https://keybase.io/willtonkin) on keybase.
  • I have a public key whose fingerprint is D246 2C82 5D28 7F16 C90B 5ADE AE8B 578F DEC4 39D2

To claim this, I am signing this object:

@willtonkin
willtonkin / dialog.xml
Created May 28, 2015 10:19
Advanced AEM dialog validation Example - includes RegEx field check and complicated logic
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="cq:Dialog"
title="My Dialog"
xtype="dialog">
<items
jcr:primaryType="cq:Widget"
xtype="tabpanel">
<items jcr:primaryType="cq:WidgetCollection">
<tab1
@willtonkin
willtonkin / gist:9a812dd9e71eb23b4648
Last active August 29, 2015 14:24
JSP/JSTL/Sling Cheatsheet
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<h2>Important Functions</h2>
String : ${fn:replace(inputString, beforeSubstring, afterSubstring)}
String : ${fn:substring(string, beginIndex, endIndex)}
int : ${fn:length(collection or string)}
boolean : ${fn:startsWith(string, prefix)}
@willtonkin
willtonkin / ps4.cfg
Created June 28, 2016 10:53
PS4 Controller config for Quake 1
joyyawsensitivity "-1.0"
joypitchsensitivity "1.0"
joysidesensitivity "1.0"
joyforwardsensitivity "-1.0"
joyyawthreshold "0.15"
joypitchthreshold "0.15"
joysidethreshold "0.15"
joyforwardthreshold "0.15"
joyadvaxisv "4"
joyadvaxisu "0"