Skip to content

Instantly share code, notes, and snippets.

View elidupuis's full-sized avatar

Eli Dupuis elidupuis

View GitHub Profile
$('#slideshow').qCycle({
toLoad: images,
cycleOpts: {
fx: 'fade',
timeout: 3*1000,
pager: '#pagers'
},
createSlide: function (img) {
var data = img.data('qCycle.slideData');
var slide = $('<div>').addClass('slide').append($(img).attr('alt',data.title));
(function($) {
$.fn.thePlugin = function(options) {
// build main options before element iteration:
var opts = $.extend({}, $.fn.thePlugin.defaults, options);
var $this = $(this);
var thePlugin = {
index: 0,
@elidupuis
elidupuis / safari_search_input
Created November 18, 2010 21:19
Make Safari render an search input as a regular text input
input[type="search"] { -webkit-appearance: textfield; }
@elidupuis
elidupuis / jquery_plugin_template.js
Created December 17, 2010 01:26
A base structure to use when building new plugins!
(function($) {
var methods = {
init: function( options ) {
// iterate and reformat each matched element
return this.each(function() {
var $this = $(this),
opts = $.extend({}, $.fn.PLUGIN_NAME.defaults, options),
data = $this.data('PLUGIN_NAME');
@elidupuis
elidupuis / jquery.equalizeHeights.js
Created February 28, 2011 23:07
Simple plugin to equalize the heights of selected elements
// stolen from http://api.jquery.com/map/
// usage: $('div').equalizeHeights();
$.fn.equalizeHeights = function(){
return this.height( Math.max.apply( this, $(this).map(function(i,e){ return $(e).height() }).get() ) );
}
@elidupuis
elidupuis / purrrify.click.html
Created April 8, 2011 04:31
Usage examples of the jquery.purrrify plugin
<script>
$(function(){
// this will trigger purrrify when $('#myTrigger') is clicked:
$.purrrify({
trigger: { selector: '#myTrigger', event: 'click' }
});
});
</script>
@elidupuis
elidupuis / bookmarklet.js
Created May 13, 2011 17:19
How to create a bookmarklet with an external js file.
// use this code as your href attribute on your 'Install this bookmarklet' anchor tag.
// borrowed from http://net.tutsplus.com/tutorials/javascript-ajax/create-bookmarklets-the-right-way/
javascript:(function(){var jsCode = document.createElement('script');jsCode.setAttribute('src', 'http://example.com/path/to/file.js');document.body.appendChild(jsCode);}());
@elidupuis
elidupuis / jquery.matchWidth.js
Created August 10, 2011 21:15
jquery plugin to set the width of an element to the sum of it's children's width
$.fn.matchWidth = function(){
// Prepare
var $this = $(this);
// Action
$this.width(function(){
var w = 0;
$(this).children().each(function(){
w += $(this).outerWidth(true);
});
@elidupuis
elidupuis / handlebars-helpers.js
Last active December 7, 2021 02:24
Simple Handlebars.js helpers
/*! ******************************
Handlebars helpers
*******************************/
// debug helper
// usage: {{debug}} or {{debug someValue}}
// from: @commondream (http://thinkvitamin.com/code/handlebars-js-part-3-tips-and-tricks/)
Handlebars.registerHelper("debug", function(optionalValue) {
console.log("Current Context");
console.log("====================");
@elidupuis
elidupuis / README.md
Created December 6, 2012 21:41
D3 + Albers + zoom behavior

Alberta Aboriginal Treaty Lands.