Skip to content

Instantly share code, notes, and snippets.

@shanejdonnelly
shanejdonnelly / ie_debug_console.js
Created June 11, 2012 16:19
Add a debug console to IE
//set the console log area up - only populated if IE
$('body').append('<div id="debug" style="position: absolute; top: 0; left: 200px; background: #fff; display: none; visibility: hidden;"></div>')
//log messages to this function instead of using console.log
function ie_console_log(console_message) {
try {
console.log(console_message)
}
catch (e) {
$('#debug').append('<div class="debug">'+ console_message +'</div>')
@shanejdonnelly
shanejdonnelly / bgResize.js
Created June 12, 2012 17:33
A plugin to simulate background:cover in IE
/*
* Plugin Name : imgResize
* Author : Shane Donnelly
*/
(function($){
//here's our resizer object
$.Resize = function (el, options) {
this.options = options;
this.$el = $(el);
@shanejdonnelly
shanejdonnelly / link_highlight.js
Created June 14, 2012 15:27
highlight current nav link with js
@shanejdonnelly
shanejdonnelly / basicImageCycler.js
Created June 18, 2012 19:36
jQuery Image Cycler
/*
* Plugin Name : basicImageCycler
* Author : Shane Donnelly
*/
(function($){
$.fn.basicImageCycler = function(options){
var defaults = {
'images' : [],
@shanejdonnelly
shanejdonnelly / responsiveEvents.js
Created June 22, 2012 15:50
React to responsive events
/*
* Plugin Name : responsiveEvents
* Author : Shane Donnelly
*/
(function($){
$.fn.responsiveEvents = function(options){
var defaults = {
'phone_portrait' : true,
@shanejdonnelly
shanejdonnelly / tech_window.js
Created July 6, 2012 17:32
tech window for tbl
;(function($){
//here's our TechWindow constructor
$.TechWindow = function (el, options) {
this.options = options;
this.$el = $(el);
this.init();
};
//default options
rand: function(min, max){
var rand = Math.random() * (max - min) + min;
return Math.round(rand);
}
{
urls:[
{url:'http://google.com', comment:'so funny', user:'Joe Schmoe'},
{url:'http://google.com', comment:'so funny', user:'Joe Schmoe'},
{url:'http://google.com', comment:'so funny', user:'Joe Schmoe'},
{url:'http://google.com', comment:'so funny', user:'Joe Schmoe'}
]
}
$.fn.teletype = function(opts){
var $this = this,
defaults = {
animDelay: 50
},
settings = $.extend(defaults, opts);
$.each(settings.text.split(''), function(i, letter){
setTimeout(function(){
$this.html($this.html() + letter);
@shanejdonnelly
shanejdonnelly / date.js
Created February 5, 2015 21:46
Extend javascript Date object with handy day and month name methods.
Date.locale = {
en: {
day_names: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
day_names_short: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
month_names: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
month_names_short: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
}
};
//====================================================