Skip to content

Instantly share code, notes, and snippets.

Phil Ricketts replete

Block or report user

Report or block replete

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@replete
replete / syncHeightWrapper.js
Last active Dec 18, 2015
Wrapper for jQuery.syncHeight(). Allows you to have multiple instances on a page with specifically instantiating them.
View syncHeightWrapper.js
// Hastily plonked together by @replete, phil@replete.nu
/* Use like this:
<div class="some-html-chunk" data-sync-height="a-unique-name">Foo</div>
<div class="some-other-html-chunk" data-sync-height="a-unique-name">Bar</div>
*/
$('[data-sync-height]')
.each(function(i,e){
@replete
replete / updateVBA.sh
Created Mar 15, 2013
script to update vagrant VM virtualbox additions to specified version.
View updateVBA.sh
#!/bin/sh
#Update script for VBoxGuestAdditions
VBA_VERSION=4.2.8
wget -c http://download.virtualbox.org/virtualbox/${VBA_VERSION}/VBoxGuestAdditions_${VBA_VERSION}.iso
sudo mount VBoxGuestAdditions_${VBA_VERSION}.iso -o loop /mnt
sudo sh /mnt/VBoxLinuxAdditions.run --nox11
rm -f VBoxGuestAdditions_${VBA_VERSION}.iso
@replete
replete / gist:4158314
Created Nov 28, 2012
jquery.autoGrowInput.js
View gist:4158314
(function($){
$.fn.autoGrowInput = function(o) {
o = $.extend({
maxWidth: 1000,
minWidth: 0,
comfortZone: 70
}, o);
@replete
replete / YuiCompressor.ashx
Created Nov 13, 2012
YUI Compressor for .net Handler
View YuiCompressor.ashx
<%@ WebHandler Language="C#" Class="YuiCompressor" %>
// Requirements:
// bin/Yahoo.Yui.Compressor.dll (See the project on codeplex)
// bin/EcmaScript.NET.dll
// bin/EcmaScript.NET.dll
// bin/Iesi.Collections.dll
//
// How to use this, in your templates or HTML:
//
@replete
replete / _mixin_2ximages.scss
Created Oct 11, 2012
Images 2x - retina images mixin
View _mixin_2ximages.scss
@mixin image-2x($image1, $image2) {
background-image: url($image);
@media (min--moz-device-pixel-ratio: 1.3),
(-o-min-device-pixel-ratio: 2.6/2),
(-webkit-min-device-pixel-ratio: 1.3),
(min-device-pixel-ratio: 1.3),
(min-resolution: 1.3dppx) {
background-image: url($image2);
background-size: image-width($image1) image-height($image1);
}
@replete
replete / gist:3048826
Created Jul 4, 2012
Add class to <body> based on viewport width (IE7+, possibly IE6+)
View gist:3048826
var d = document,
b = d.getElementsByTagName("body"),
w = window,
c = "className",
v = (function() { return w.innerWidth || d.documentElement.clientWidth }),
r = function () {
i = v();
if (i < 181) { b[0][c] = "max-180"; return }
if (i < 246) { b[0][c] = "max-245"; return }
else { b[0][c] = "" }
View gist:2436076
$.loadCss=function(css){$('head').append('<link rel="stylesheet" type="text/css" href="'+css+'">')};
@replete
replete / gist:2385061
Created Apr 14, 2012
Text entry character count and truncate contenteditable
View gist:2385061
/* -------------------------------------- */
//Char count & truncate
var $charCount = $("[data-char-count]");
$charCount.each(function () {
var $this = $(this),
$charSelector = $($this.attr("data-char-count")),
charMax = $this.attr("data-char-count-max") || false;
@replete
replete / gist:2385046
Created Apr 14, 2012
iOS like scrollbars (requires nicescroll)
View gist:2385046
/* -------------------------------------- */
//iOS-like scrollbar
var $niceScrollContainers = $("[data-ios-scroll]");
$niceScrollContainers.each(function () {
var $container = $(this),
scrollClass = $container.attr("data-ios-scroll"),
cursorWidth = "6px",
$contentsLastChild = $container.children("*:last-child");
@replete
replete / gist:2385033
Created Apr 14, 2012
Simple content panes with navigation
View gist:2385033
/* -------------------------------------- */
//Content panes with navigation
var $panesContainers = $("[data-panes]");
$panesContainers.each(function () {
var $container = $(this),
$items = $container.children($container.attr("data-panes")),
itemTotal = $items.length - 1,
$navigation = $container.find($container.attr("data-panes-navigation"));
You can’t perform that action at this time.