Skip to content

Instantly share code, notes, and snippets.

View timsnadden's full-sized avatar

Tim Snadden timsnadden

  • Wellington, New Zealand
View GitHub Profile
<key>com.mcafee.menulet</key>
<dict>
<key>Disabled</key>
<true/>
<key>KeepAlive</key>
<false/>
</dict>
<key>com.mcafee.reporter</key>
<dict>
<key>Disabled</key>
@timsnadden
timsnadden / apacheConfMonitor
Last active December 27, 2015 18:09
Monitor modifications to apache config on mac and restart server. Place in /Library/LaunchAgents/
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.snadden.apacheConfMonitor</string>
<key>KeepAlive</key>
<true/>
<key>RunAtLoad</key>
<true/>
@timsnadden
timsnadden / rem mixin
Created April 2, 2013 07:38
Less mixin for doing font-sizing/line-heights with rems and falling back to px for browsers without rem support.
.font-size(@sizeValue){
@remValue: @sizeValue / 10;
@pxValue: (@sizeValue);
font-size: ~"@{pxValue}px";
font-size: ~"@{remValue}rem";
}
.line-height(@sizeValue){
@remValue: @sizeValue / 10;
@pxValue: (@sizeValue);
@timsnadden
timsnadden / gist:1927187
Created February 27, 2012 21:21
jQuery Google Analytics outbound link tracking
// Need to delay external links to allow analytics to fire
$('a[href^="http"]').on('click', function(e){
e.preventDefault();
_gaq.push(['_trackEvent', 'Outbound', 'click', this.href]);
window.setTimeout(function() {
window.location = arguments[0];
}, 200, this.href);
});
@timsnadden
timsnadden / Chromeframe apache conf
Created October 27, 2010 03:36
Apache directive that triggers chromeframe if it is available
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
BrowserMatch chromeframe gcf
Header append X-UA-Compatible "chrome=1" env=gcf
</IfModule>
</IfModule>
$.fn.detectTextResize = function() {
return this.each(function() {
var el = $(this);
var initialSize = el.css('font-size');
setInterval(function(){
var currentSize = el.css('font-size');
if(currentSize != initialSize){
initialSize = currentSize;
el.trigger('textResized');
}
@timsnadden
timsnadden / jquery.equalheights.js
Created August 6, 2010 01:42
jquery equal heights
$.fn.equalHeights = function() {
/* Create an array of element heights */
var heights = this.map(function() {
return $(this).height();
}).get();
/* Find the tallest */
var max = Math.max.apply(null, heights);
/* Set all elements to be equal height */
$.fn.corners = function() {
return this.each(function() {
var self = $(this);
self.append($('<span class="corner tl"></span><span class="corner tr"></span><span class="corner bl"></span><span class="corner br"></span>'));
if( self.css('position') == 'static' ) { self.addClass('relative'); }
});
};
$.extend($.support, {
borderRadius: function() {
var s = document.createElement("div").style;
return typeof s.MozBorderRadius == 'string' ||
typeof s.WebkitBorderRadius == 'string' ||
typeof s.KhtmlBorderRadius == 'string' ||
typeof s.borderRadius == 'string';
}()
});
$.fn.toggleText = function(a, b) {
return this.text(a == this.text() ? b : a);
};