Skip to content

Instantly share code, notes, and snippets.

View seutje's full-sized avatar

Steve De Jonghe seutje

View GitHub Profile
@seutje
seutje / cssRefresh.bookmarklet.js
Created July 7, 2011 11:48
Goes over all <link> elements and appends a timestamp to their href so they get reloaded.
javascript:(function(a,b,c,d,e){d=a.length;for(;d--;){e=a[d];if(e.rel=='stylesheet'){e.href=e.href.split(c)[0]+c+b;}}})(document.getElementsByTagName('link'),new Date().getTime(),'?');
@seutje
seutje / goToNode.bookmarklet.js
Created July 8, 2011 11:59
Bookmarklet to go to node X
javascript:(function(w,l){l=w.location.href.split('/');w.location=l[0]+l[1]+'/node/'+w.prompt('Node ID?');})(window);
@seutje
seutje / codecEntity.js
Created August 5, 2011 12:58
decodeEntity(str): pass it a string with entities and it'll return a string without entities! encodeEntity obviously does the opposite but only when it would need to be encoded for use as a textnode
window.decodeEntity = window.decodeEntity || function(str) { var frag = document.createElement('div'); frag.innerHTML = str; return frag.innerText; }
// Examples:
// decodeEntity('&gt;'); -> '<'
// decodeEntity('&#204;'); -> 'Ì'
window.encodeEntity = window.encodeEntity || function(str) { var frag = document.createElement('div'); frag.innerText = str; return frag.innerHTML; }
// Examples:
// encodeEntity('<'); -> '&gt;'
// encodeEntity('Ì'); -> 'Ì'
@seutje
seutje / example.html
Created August 9, 2011 12:41
Helper plugin for responsive images
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Example</title>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
article, aside, figure, footer, header, hgroup,
@seutje
seutje / waffles.txt
Created September 10, 2011 21:01
Liège waffles
Liège waffles (the kind of Belgian waffles that have chunks of sugar in em)
makes about 15 waffles
ingedients:
- 800gr flour
- 270gr milk at room temperature
- 70gr fresh yeast
- 3 eggs and 3 yolks
@seutje
seutje / fix.drupal.autocomplete.js
Created September 30, 2011 10:02
Fix Drupal's autocomplete for use with nasty ad scripts that fiddle with Array.indexOf
/**
* Fills the suggestion popup with any matches received
*/
Drupal.jsAC.prototype.found = function (matches) {
// Bail if we get an array (adhese script related)
if (matches instanceof Array) { return false; }
// If no value in the textfield, do not show the popup.
if (!this.input.value.length) {
return false;
}
@seutje
seutje / bunnywithprunes
Created October 17, 2011 20:32
recipe for bunny with prunes
1 cute young bunny, cut in pieces
1 union and 2 shallots (shredded)
splash of raspberry vinegar
some bay laurel, thyme and parsley (and maybe some rosemary)
1 bottle of dark abbey beer or a dark trappist (33cl, ~11oz, Dark Leffe, Rochefort, Grimbergen, ... just nothing too sour)
8 dried prunes, soaked and pitted
butter
optional: tiny chunks of smoked bacon, pickled unions
@seutje
seutje / bolognese.txt
Created October 26, 2011 14:01
Bolognese sauce like my dad makes it
For 4 ppl:
- 4 large unions, shredded
- 8 bulbs of garlic, shredded
- 200gr (7oz) of herb butter
- 1kg (~2lbs) tomato purée (use less if it's concentrated) (you could replace part of this with fresh, pealed tomatoes, just don't use roma tomatoes or something like that as these are too hard)
- .5kg (~1lbs) mixed minced meat (pork/beef, but feel free to use 100% veal if you're fancy like that)
- tiny bit of starch (for those who like their sauce rly thick)
melt the herb butter in a deep pan (this is where the sauce will end up in)
sweat the unions and garlic in the herb butter, make sure it doesn't go brown, so a rly gentle fire
@seutje
seutje / equalizeHeights.jquery.js
Created November 3, 2011 14:37
equalize the height of all elements in a jQuery collection, takes padding and borders into account, but doesn't wait for images to be loaded. Consider using this plugin when equalizing elements that contain images: https://github.com/desandro/imagesloaded
(function($) {
$.fn.equalizeHeights = function(smallest){
var largest = 0;
this.css('height', '').each(function() {
var height = $(this).outerHeight();
if (!smallest) {
if(height > largest) largest = height;
}
else {
@seutje
seutje / _rgba.scss
Created November 4, 2011 15:17
rgba mixin
@mixin rgba-ie($color, $alpha) {
$rgba: rgba($color, $alpha);
$ie-hex-str: ie-hex-str($rgba);
background-color: transparent;
background-color: $rgba;
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#{$ie-hex-str},endColorstr=#{$ie-hex-str});
zoom: 1;
}