Skip to content

Instantly share code, notes, and snippets.

View OllyHodgson's full-sized avatar

Olly Hodgson OllyHodgson

View GitHub Profile
@OllyHodgson
OllyHodgson / buttons.css
Created October 11, 2012 17:17
Remarkably similarly stlyed buttons across IE7/8/9, FF, Chrome, Safari and Opera
/******************************************************************
*
* COMPONENTS: BUTTONS AND BUTTON-STYLE LINKS
* e.g. <button>Click me!</button>
* or <a class="button">Click me!</a>
* or <input type="submit" value="Click me!" />
*
******************************************************************/
.outer a.button,
.outer a.button:link,
@OllyHodgson
OllyHodgson / encoding.htm;
Created November 30, 2012 11:25
While testing a system, we found some "interesting" HTML encoding behaviour. For a given value of "interesting", obviously.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Escaping fun!</title>
</head>
<body>
<!-- Renders as 'abcd' -->
<p>abcd<efg</p>
<!-- Renders as 'abcd<&efg' -->
@OllyHodgson
OllyHodgson / sparkline.svg
Created January 7, 2013 09:50
Stuart Langridge's Simple SVG sparklines — http://kryogenix.org/days/2012/12/30/simple-svg-sparklines — but using an object element instead of an embed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@OllyHodgson
OllyHodgson / detectIEfiltersupport.js
Last active December 16, 2015 02:19
Test for IE legacy Filters and Transitions support
/*
Test if this install of IE supports legacy Filters and Transitions
Needed because Filters and Transitions can be disabled under IE's security
settings ("Binary and Script Behaviors" under the "ActiveX controls and
plug-ins" category). This is often done on corporate windows installations
"for security reasons". They'll fail silently (or error if you try to access
the element's filter collection in js). This setting also disables VML.
See:
@OllyHodgson
OllyHodgson / modernizr-ielegacyfilters.js
Last active December 16, 2015 02:19
Modernizr test for legacy IE Filters and Transitions (COMPLETELY UNTESTED!)
/*
Modernizr test for legacy IE Filters and Transitions
I haven't tested this with Modernizr! Just adapted my solution to look like
https://gist.github.com/farmdawgnation/2636061
Needed because Filters and Transitions can be disabled under IE's security
settings ("Binary and Script Behaviors" under the "ActiveX controls and
plug-ins" category). This is often done on corporate windows installations
"for security reasons". They'll fail silently (or error if you try to access
@OllyHodgson
OllyHodgson / Strip out some spurious HTML.js
Last active March 14, 2016 14:02
Run this in the devtools console on a SharePoint 2010 page when in edit mode, to strip out some spurious crap from the HTML.
/*
Run this in the devtools console on a SharePoint 2010 page when in edit mode, to strip out some spurious crap from the HTML.
*/
(function($, window, document) {
var $editables = $("[contenteditable], input[type='hidden'][id*='hiddenStorage'], input[type='hidden'][id*='hiddenDisplay'], input[type='hidden'][id^='ctl00'][id$='content']", ".edit-mode"),
originalHTML,
filterHTML,
$el,
$filterHTML,
@OllyHodgson
OllyHodgson / Strip out spurious HTML.js
Last active March 14, 2016 14:02
Run this in the devtools console on a SharePoint 2010 page when in edit mode, to strip out quite a lot of spurious crap from the HTML.
/*
Run this in the devtools console on a SharePoint 2010 page when in edit mode, to strip out quite a lot of spurious crap from the HTML.
*/
(function($, window, document) {
var $editables = $("[contenteditable], input[type='hidden'][id*='hiddenStorage'], input[type='hidden'][id*='hiddenDisplay'], input[type='hidden'][id^='ctl00'][id$='content']"),
originalHTML,
filterHTML,
$el,
$filterHTML,
@OllyHodgson
OllyHodgson / jQuery.stripZWSP-1.0.js
Last active November 2, 2016 19:35
The Sharepoint Rich HTML editor leaves ZERO WIDTH SPACE chracters (&#8203; or \u200B) all over the place. This trawls through the HTML you pass in and strips out zero width space characters from text nodes within. Potentially a sledgehammer/nut solution...
/*
* The Sharepoint Rich HTML editor leaves ZERO WIDTH SPACE chracters (&#8203;
* or \u200B) all over the place. This trawls through the HTML you pass in and
* strips out zero width space characters from text nodes within.
*
* http://blog.bugrapostaci.com/2014/02/02/publishing-field-encoding-extra-questionmark-charecters-actually-acsii-8203-zero-width-space/
*
* This trawls through the HTML you pass in and strips out zero width space
* characters from text nodes within.
*
@OllyHodgson
OllyHodgson / SP2010-Bootstrap3-Fixes.less
Created October 10, 2013 14:08
Some CSS fixes to make SharePoint 2010 Publishing sites get along better with Bootstrap 3. For the most part, it sets SP2010's own UI elements to use `box-sizing: content-box;` instead of `box-sizing: border-box;` as used by BS3. Either import this at the end of bootstrap.less, or after importing bootstrap.less into your own .less files.
/****************************************************************************
*
* This LESS file contains fixes to make Bootstrap 3 play nicely with
* SharePoint 2010 Publishing pages. It mainly switches SP2010's UI
* elements back to the "content-box" box-model.
*
* It also incorporates the CSS portions of Kyle Schaeffer's fixes for
* scrolling on SP2010. The JS part is called from the master page.
*
****************************************************************************/
@OllyHodgson
OllyHodgson / index.html
Created March 20, 2018 16:39
CSS flexbox layout experiment - boxes breaking out of boxes. It later occurred to me that CSS Grid might have been the better tool. Hey ho.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title></title>
<style>
html,
body {