Skip to content

Instantly share code, notes, and snippets.

Avatar

Eli Dupuis elidupuis

View GitHub Profile
View qcycle-calling-it.js
$('#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));
View jquery-plugin-pattern.js
(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 Nov 18, 2010
Make Safari render an search input as a regular text input
View safari_search_input
input[type="search"] { -webkit-appearance: textfield; }
@elidupuis
elidupuis / jquery_plugin_template.js
Created Dec 17, 2010
A base structure to use when building new plugins!
View jquery_plugin_template.js
(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 Feb 28, 2011
Simple plugin to equalize the heights of selected elements
View jquery.equalizeHeights.js
// 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 Apr 8, 2011
Usage examples of the jquery.purrrify plugin
View purrrify.click.html
<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
How to create a bookmarklet with an external js file.
View bookmarklet.js
// 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 Aug 10, 2011
jquery plugin to set the width of an element to the sum of it's children's width
View jquery.matchWidth.js
$.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 Jul 7, 2020
Simple Handlebars.js helpers
View handlebars-helpers.js
/*! ******************************
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 Dec 6, 2012
D3 + Albers + zoom behavior
View README.md

Alberta Aboriginal Treaty Lands.

You can’t perform that action at this time.