Skip to content

Instantly share code, notes, and snippets.

@fission6
fission6 / es.sh
Created January 16, 2012 19:21 — forked from aaronshaf/es.sh
Install ElasticSearch on Ubuntu 11.04
cd ~
sudo apt-get install unzip
sudo apt-get install python-software-properties -y
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin -y
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.17.6.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
@fission6
fission6 / optional_boost.py
Created January 28, 2012 17:39 — forked from toastdriven/optional_boost.py
For fission6...
>>> from haystack.inputs import Raw
>>> from haystack.query import SearchQuerySet, SQ
>>> sqs = SearchQuerySet().filter(content='python')
>>> sqs2 = SearchQuerySet().filter(SQ(content='python') | (SQ(content='python') & SQ(content=Raw('pycon^10'))))
>>>
>>> sqs.count()
16
>>> sqs2.count()
16
>>>
@fission6
fission6 / remote-typeahead.js
Created June 27, 2012 19:47 — forked from geuis/remote-typeahead.js
Remote data querying for Twitter Bootstrap 2.0 Typeahead without modifications
<script>
// Charles Lawrence - Feb 16, 2012. Free to use and modify. Please attribute back to @geuis if you find this useful
// Twitter Bootstrap Typeahead doesn't support remote data querying. This is an expected feature in the future. In the meantime, others have submitted patches to the core bootstrap component that allow it.
// The following will allow remote autocompletes *without* modifying any officially released core code.
// If others find ways to improve this, please share.
var autocomplete = $('#searchinput').typeahead()
.on('keyup', function(ev){
ev.stopPropagation();
@fission6
fission6 / geo_hstore_manager.py
Created October 16, 2012 21:22 — forked from glenrobertson/geo_hstore_manager.py
Combine Django GeoManager with HStoreManager
# pip install django-orm-extensions
from django.contrib.gis.db.models import GeoManager
from django.contrib.gis.db.models.query import GeoQuerySet
from django.contrib.gis.db.models.sql.where import GeoWhereNode
from django.contrib.gis.db.models.sql import GeoQuery
from django_hstore.query import HStoreQuerySet, HStoreWhereNode
from django_hstore.managers import HStoreManager
class GeoHStoreWhereNode(GeoWhereNode, HStoreWhereNode):
@fission6
fission6 / gist:4164144
Created November 28, 2012 20:32 — forked from dgouldin/gist:1207636
Django templatetag to output the current page's querystring updated with the specified values including context variables.
from django import template
register = template.Library()
class UpdateQuerystringNode(template.Node):
def __init__(self, **kwargs):
self.kwargs = kwargs
def render(self, context):
# gunicorn.conf.py: getting gevent and gevent-psycopg2 running
bind = '127.0.0.1:1437'
accesslog = "<some-path>/logs/gunicorn-access.log"
errorlog = "<some-path>/logs/gunicorn-error.log"
workers = 5
try:
# fail 'successfully' if either of these modules aren't installed
from gevent import monkey
import gevent_psycopg2
#/usr/bin/env python3
# -*- coding: utf-8 -*-
# _______ _______ _ _________ _ _______
# |\ /|( ___ )( ____ )( ( /|\__ __/( ( /|( ____ \
# | ) ( || ( ) || ( )|| \ ( | ) ( | \ ( || ( \/
# | | _ | || (___) || (____)|| \ | | | | | \ | || |
# | |( )| || ___ || __)| (\ \) | | | | (\ \) || | ____
# | || || || ( ) || (\ ( | | \ | | | | | \ || | \_ )
# | () () || ) ( || ) \ \__| ) \ |___) (___| ) \ || (___) |