Skip to content

Instantly share code, notes, and snippets.

View atkinson's full-sized avatar

Rich Atkinson atkinson

View GitHub Profile
@atkinson
atkinson / gist:1435489
Created December 5, 2011 21:37
tropo test
#!/usr/bin/env python
try:
import cjson as jsonlib
jsonlib.dumps = jsonlib.encode
jsonlib.loads = jsonlib.decode
except ImportError:
try:
from django.utils import simplejson as jsonlib
{
"amount": "81.52",
"beneficiary_address": "F1 Soft\nNepal",
"beneficiary_agent_code": "745",
"beneficiary_id": "0425261410",
"beneficiary_name": "Sumit Baskota",
"beneficiary_phone": "5551234",
"commission": "0",
"exchange_rate": "81.52",
"id_type": "O",
@atkinson
atkinson / views.py
Created October 25, 2011 11:09
Keep top level facet counts when drilling down in haystack
from haystack.views import FacetedSearchView
class StickyFacetedSearchView (FacetedSearchView):
def top_level_facets(self):
"""
When selecting a facet to drill down the results,
we need to keep the top level facet counts
"""
stored_query = self.request.session.get('query', None)
@atkinson
atkinson / nginx.conf.txt
Created October 25, 2011 06:16
nginx wordpress
root /path/to/wordpress;
index index.php index.html;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
location / {
fastcgi_index index.php;
# if your fast-cgi is somewhere else, change this
fastcgi_pass 127.0.0.1:9000;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta name="viewport" content="width=default-width; user-scalable=no" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<title>Load WebSQL Database from text file of SQL statements;</title>
<style type="text/css">
body, html { background-color: #444444; }