Skip to content

Instantly share code, notes, and snippets.

View seutje's full-sized avatar

Steve De Jonghe seutje

View GitHub Profile
I totally agree with you on the point that it's a way better idea to tailor for conditions rather than predefined devices/browsers/platforms, but the problem with "responsive webdesign" (hate that buzzword btw) is that there doesn't seem to be a way to set conditions for things like download speed.
for instance: every1 seems to assume that mobile devices have a crappy connection by definition, but I'd say there's a world of difference between say, a mobile device on EDGE or one on 3G, or even one on speedy wifies. Or the other side of it: a 17" laptop on a 3G stick (or tethering over a phone) vs one on a cable modem. Regardless of viewport size, you might want to present the user on 3G with a link to an image, allowing them to decide if they want to load it up, and present the user on a cable modem with the image straight up. This is just a quick example off the top of my head, but I'm sure others can think of more examples...
Also, I've noticed that most ppl struggle with doing "responsive webdesign" right
@seutje
seutje / balloons.jquery.js
Created March 23, 2011 12:27
Make stuff hover around like balloons or something, assumes elements are already positioned absolute with top and left/right values.
;(function($){
$.fn.balloons = function(options) {
var balloons = this,
cssAnim = Modernizr && Modernizr.cssanimations,
opts = $.extend({}, $.fn.balloons.defaults, options),
/* Helper function to return random range */
getRand = function(min, max) {
return Math.floor(Math.random() * (min-max+1)) + max;
},
@seutje
seutje / jquery.wrapInChunks.js
Created April 18, 2011 16:00
Takes a jQuery collection and wraps each x items with element y
/**
* takes a jQuery collection and wraps each x items with element y
* kinda nasty looking though
* Example: $('#foo').children().wrapInChunks('<div></div>', 2);
* would wrap every 2 children of #foo with a div
*/
jQuery.fn.wrapInChunks = function(html, chunkSize) {
chunkSize = chunkSize || 1;
var items = this.get(),
rows = [],
@seutje
seutje / menu.scss
Created May 2, 2011 08:00
Using SASS lists to ease irregular menu theming
/* CSS3Please.com gradient mixin */
@mixin gradient($begin, $end) {
background-color: $begin;
background-image: -moz-linear-gradient(top, $begin, $end); /* FF3.6 */
background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, $begin),color-stop(1, $end)); /* Saf4+, Chrome */
background-image: linear-gradient(top, $begin, $end);
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='$begin', EndColorStr='$end'); /* IE6–IE9 */
@include has-layout;
}
@seutje
seutje / _grid.scss
Created May 2, 2011 15:46
GRID HOLLA!
$defWidth: 960px; /* Default page width */
$defGut: 10px; /* Default single gutter size */
$defAm: 12; /* Default amount of columns */
@mixin container($num, $amount: $defAm, $width: $defWidth) {
margin-left: auto;
margin-right: auto;
width: ($width/$amount)*$num;
position: relative;
@extend .clearfix;
@seutje
seutje / duplicateIDs.bookmarklet.js
Created May 9, 2011 15:03
Look for duplicate IDs and report them in the console
(function(a){var b=[],c="";a("[id]").each(function(c,d){if(a("[id="+this.id+"]").length>1){b.push(this.id)}});if(b.length){c="Druplicate IDs: "+b.join(", ");window.console&&window.console.log?window.console.log(c):window.alert(c)}})(jQuery)
@seutje
seutje / jquery.replaceclass.js
Created May 30, 2011 11:37
silly replaceClass plugin
(function($) {
jQuery.fn.replaceClass = function(toReplace,replaceWith){
return this.each(function(){
return $(this).removeClass(toReplace).addClass(replaceWith);
});
}
})(jQuery);
@seutje
seutje / gist:1012333
Created June 7, 2011 14:16
scrolldiv example
http://jsbin.com/utigo5/2/edit
@seutje
seutje / printLinks.js
Created June 10, 2011 15:43
Drupal.behaviors.printLinks
@seutje
seutje / jquery.wrapInChunks.js
Created June 20, 2011 14:47
jQuery plugin to wrap every x items with element y
// Expose the Array.reverse() method on jQuery objects
$.fn.reverse = [].reverse;
/**
* takes a jQuery collection and wraps each x items with element y
* kinda nasty looking though
* example: $('.foo').children().wrapInChunks('<div class="bar" />', 3);
* wraps every 3 children of .foo in div.bar
* NOTE: Needs a way to distinguish the wrapper from the wrapped elements,
* ergo, wrapping classless, IDless DIVs with classless, IDless DIVs will error out
*/