Skip to content

Instantly share code, notes, and snippets.

Ian ijones922

  • United States
Block or report user

Report or block ijones922

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
View windowload
$(window).load(function() {
// executes when complete page is fully loaded, including all frames, objects and images
alert("window is loaded");
});
View ellipsis
/* elipsify any text you want to truncate. Simply use .text(cut([n])) then .append() to add in any character(s) you want after. ex: ('...')*/
function cut(n) {
return function textCutter(i, text) {
var short = text.substr(0, n);
if (/^\S/.test(text.substr(n)))
return short.replace(/\s+\S*$/, "");
return short;
};
}
View gist:5952846
html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6,
p, blockquote, pre, abbr, address, cite, code, del, dfn, em,
img, ins, kbd, q, samp, small, strong, sub, sup, var, b, i, dl,
dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption,
tbody, tfoot, thead, tr, th, td, article, aside, canvas, details,
figcaption, figure, footer, header, hgroup, menu, nav, section,
summary, time, mark, audio, video {
margin:0;
padding:0;
border:0;
View gist:5952781
/**
* Great little debuging snippet found while browsing
* The code adds different coloured borders to the assets depending on its level.
* Leave commented out if not needed.
*/
* { outline: 2px dotted red }
* * { outline: 2px dotted green }
* * * { outline: 2px dotted orange }
* * * * { outline: 2px dotted blue }
@ijones922
ijones922 / gist:5952705
Created Jul 8, 2013
Javascript: Preloading images
View gist:5952705
/**
* [ Preloading images is useful: Instead of loading an image when the user request it,
* we preload them in the background so they are ready to be displayed. Doing so in jQuery
* is very simple, as shown below:]
* Source: http://engineeredweb.com/blog/09/12/preloading-images-jquery-and-javascript
* @param {[type]} $
* @return {[type]}
*/
(function($) {
var cache = [];
@ijones922
ijones922 / gist:5952576
Created Jul 8, 2013
Javascript: equal column heights
View gist:5952576
function matching_heights() {
var highestCol = Math.max($('').height(),$('').height());
$('').height(highestCol);
}
@ijones922
ijones922 / gist:5952528
Created Jul 8, 2013
Javascript: document ready
View gist:5952528
$(document).ready(function(){
alert("success");
});
You can’t perform that action at this time.