Skip to content

Instantly share code, notes, and snippets.

@vicalejuri
vicalejuri / django-crossdomainxhr-middleware.py
Created June 5, 2010 17:47
Middlware to allow's your django server to respond appropriately to cross domain XHR (postMessage html5 API).
import re
from django.utils.text import compress_string
from django.utils.cache import patch_vary_headers
from django import http
try:
import settings
XS_SHARING_ALLOWED_ORIGINS = settings.XS_SHARING_ALLOWED_ORIGINS
import redis
from django.conf import settings
from django.core.signals import request_finished
try:
from eventlet.corolocal import local
except ImportError:
from threading import local
@mrjjwright
mrjjwright / backbone.history.html5.coffee
Created March 1, 2011 16:55
Add pretty html5 history support to Backbone
#
# Replaces Backbone.History with support for HTML5 history API if browser supports it.
# To use, setup your controllers as usual and try it with a browser that supports the HTML5 history API.
# For browsers that don't support the HTML5 API, this will fall back to using the default Backbone hash routing.
#
# I have only tested this on my project in Firefox, Safari and Chrome so let me know.
#
pushSupport = window.history? and window.history.pushState?
if pushSupport and Backbone? and Backbone.History?
rootUrl = document.location.protocol+'//'+(document.location.host or document.location.hostname)
@balupton
balupton / README.md
Last active April 20, 2022 13:21
Ajaxify a Website with the HTML5 History API using History.js, jQuery and ScrollTo
@bradphelan
bradphelan / pageview.js.coffee
Created June 15, 2011 13:46
backbone based mobile page model
#=require haml
#=require backbone
class PageView extends Backbone.View
tag: "div"
class: "page"
classes: ->
[]
@briandailey
briandailey / dev.md
Last active July 5, 2021 22:35
Stratasan: Senior Software Developer

Become a Stratanaut!

Who We Are

Stratasan is a Nashville-based company that provides intelligence on healthcare markets to hospital strategists, physician offices, community care experts, and others. We aggregate healthcare data, curate it, and provide reports and tools that aid healthcare decision-making. As an example, we give guidance to our clients looking to place a new acute care clinic.

@rstacruz
rstacruz / model_caching.coffee
Created September 11, 2011 14:54
Backbone.js model caching
# ## Backbone model caching
# This is a simple solution to the problem "how do I make less requests to
# my server?".
#
# Whenever you need a model instance, this will check first if the same thing
# has been fetched before, and gives you the same instance instead of fetching
# the same data from the server again.
#
# Reusing the same instance also has the great side-effect of making your
# model changeable from one part of your code, with your changes being available
@friggeri
friggeri / haiku
Created October 6, 2011 07:30
random heroku-like name generator
haiku = ->
adjs = [
"autumn", "hidden", "bitter", "misty", "silent", "empty", "dry", "dark",
"summer", "icy", "delicate", "quiet", "white", "cool", "spring", "winter",
"patient", "twilight", "dawn", "crimson", "wispy", "weathered", "blue",
"billowing", "broken", "cold", "damp", "falling", "frosty", "green",
"long", "late", "lingering", "bold", "little", "morning", "muddy", "old",
"red", "rough", "still", "small", "sparkling", "throbbing", "shy",
"wandering", "withered", "wild", "black", "young", "holy", "solitary",
"fragrant", "aged", "snowy", "proud", "floral", "restless", "divine",
@opensas
opensas / status.scala
Created December 8, 2011 19:39
tiny little scala script to check for play documentation translated files, see http://www.dzone.com/links/first_steps_with_scala_say_goodbye_to_bash_scripts.html
#!/bin/sh
exec scala -savecompiled "$0" "$@"
!#
import java.io._
val docs = new File(".").listFiles
.filter(_.getName.endsWith(".textile")) // process only textile files
.map(new DocumentationFile(_))
@jamescasbon
jamescasbon / template.py
Created December 11, 2011 16:37
Pure python templates using with statement
"""
A really stupid python template language inspired by coffeekup, markaby.
Do not use this code, it will ruin your day. A byproduct of insomnia.
TL;DR
-----
This module defines a template language that allows us to do:
d = Doc()