Skip to content

Instantly share code, notes, and snippets.

View c4urself's full-sized avatar

Christian Verkerk c4urself

  • Tubular Labs
  • Mountain View
View GitHub Profile
@c4urself
c4urself / innershiv_load.js
Created May 12, 2011 09:59
HTML5 for Ajax loaded content in IE 7 and 8
// http://www.changer.nl
// http://jdbartlett.github.com/innershiv
window.innerShiv = (function() {
var d, r;
return function(h, u) {
if (!d) {
d = document.createElement('div');
r = document.createDocumentFragment();
@c4urself
c4urself / cshowhidemenu.py
Created May 10, 2011 13:46
Simple jQuery Menu Show/hide
handleShowMenu = function(sMainLiClass, sSubUlClass) {
$(sMainLiClass).mouseover(function() {
if(current !== undefined && this !== current) {
$(sSubUlClass, current).fadeOut();
}
current = this;
var oSubmenu = $(sSubUlClass, this);
clearTimeout(timer);
@c4urself
c4urself / ccarousel.py
Created May 10, 2011 13:42
Simple jQuery Click Carousel
// szs Shizzle JS Selector
ccarousel.init = function(szsItems, szsButtonPrev, szsButtonNext) {
var numVisible = 4;
var aAllItems = $(szsItems);
renewList = function() {
aAllItems = $(szsItems);
};
aItems = $(szsItems);
oLeft = $(szsButtonPrev);
@c4urself
c4urself / settings.py
Created May 9, 2011 15:57
Django settings file as loader for server specific settings files
#
# 1. Imports base settings from `/serversettings/base.py`
# 2. Imports settings based on server name, unless:
# a. The environmental setting `SERVER_TYPE` has been set in the `django.wsgi` script
# b. The name of the server corresponds to a name in the `DEVELOPMENT_MACHINES` tuple
#
import os
import platform
import sys
import warnings
@c4urself
c4urself / search_in_models.py
Created May 9, 2011 15:48
Search in multiple django models
import operator
from django.db.models.query import QuerySet
from django.utils.encoding import smart_str
from django.db import models
def search_in_models(search_query, model_fields, queryset=False):
"""
Search in multiple models:
`model_fields` is are tuples within a tuple defining model_class, search_field pairs