Skip to content

Instantly share code, notes, and snippets.

@zackd
zackd / test-bgscript.js
Created September 29, 2009 16:11
blocks and random colors / images javascript experiment
var colors = new Array(
[116,143,138],
[78,117,143],
[191,206,197],
[0,40,40],
[0,60,60],
[0,80,80],
[0,100,100],
[165,187,181],
[134,160,154],
@zackd
zackd / thumbnail_filter.py
Created March 5, 2010 16:54
django template tag filter to generate jpeg thumbnails
# django template tag filter to generate jpeg thumbnails
import os
import Image
from django.template import Library
register = Library()
def scale(max_x, size):
" size is a tuple: (image_x,image_y) "
@zackd
zackd / galleria.onimage.click.js
Created March 9, 2010 19:21
galleria - handle just one image
// is a fix for this bug : http://code.google.com/p/galleria/issues/detail?id=62
onImage : function(image,caption,thumb) {
// fetch the thumbnail container
var _li = thumb.parents('li');
// count items
var n = parseInt(_li.siblings().length);
if (typeof n == 'undefined' || n == 0) {
// cross-browser width and height functions
function f_clientWidth() {
return f_filterResults (
window.innerWidth ? window.innerWidth : 0,
document.documentElement ? document.documentElement.clientWidth : 0,
document.body ? document.body.clientWidth : 0
);
}
function f_clientHeight() {
return f_filterResults (
@zackd
zackd / ol_zoom_slider.html
Created May 11, 2010 18:01
custom zoom control panel for openLayers (no pan controls)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">
<head>
<title>openLayers</title>
<style>
html,body {
height: 99%;
width: 99%;
}
@zackd
zackd / ol_zoom_slider2.html
Created May 12, 2010 10:07
improved: custom zoom control panel for openLayers (no pan controls)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">
<head>
<title>openLayers</title>
<style>
html,body {
height: 99%;
width: 99%;
}
<html>
<head>
<!--
just download PURE and drop this file the 'tutorial' directory
- http://beebole.com/pure/
-->
<title>PURE Unobtrusive Rendering Engine</title>
<script src="../libs/jquery.js"></script>
/**
* @fileOverview some javascript boilerplate to provide enhancements to old browsers
* @author zack @ m-og.eu
*/
/**
* JSLINT CONFIG
*/
/*jslint white: false, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true */
/*global window: false, document: false, log: false */
@zackd
zackd / nodeserver4.js
Created January 8, 2011 12:53
simple twitter stream [working!]
/*
* simple static fileserver + twitter feed
*/
var sys = require("sys"),
http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs"),
events = require("events"),
@zackd
zackd / jslint-config-for-qunit.js
Created January 25, 2011 14:44
jslint config for QUnit tests
/** JSLINT CONFIG */
/*jslint white: false, onevar: true, undef: true, nomen: false, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true */
/*global window: false, document: false, $: false, log: false, bleep: false,
// QUnit vars
QUnit: false,
test: false,
asyncTest: false,
expect: false,
module: false,
ok: false,