Skip to content

Instantly share code, notes, and snippets.

@dellsystem
dellsystem / gist:969077
Created May 12, 2011 17:58
VIPS tile processing

Look at the largest dimension (width or height)

  • 1 zoom level: 1 to 256
  • 2 zoom levels: 257 to 513
  • 3 zoom levels: 514 to 1027
  • 4 zoom levels: 1028 to 2055
  • 5 zoom levels: 2056 to 4111
  • 6 zoom levels: 4112 to 8223
  • ...
  • n zoom levels: (2^(n-2)) * (256 + 1) to (2^(n-1) * (256 + 1)) - 1 (except when n = 1, in which case the lower bound is just 1)
@dellsystem
dellsystem / process.py
Created May 12, 2011 16:56
Converting and resizing images (pyramidal tiff)
#!/usr/bin/env python
import sys, os
from PIL import Image
import math
# Does all the image processing
# Just give it a directory of images in .tif/.tiff format that are not processed
# It will find the lowest max zoom, and resize all larger images to that zoom level
# Then it will convert all the images to pyramidal tiff format, and put them into a subdirectory
# Then it will copy everything from that subdirectory to /mnt/images/dir

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

// Released under MIT license: http://www.opensource.org/licenses/mit-license.php
$('[placeholder]').focus(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
input.removeClass('placeholder');
}
}).blur(function() {
var input = $(this);