Skip to content

Instantly share code, notes, and snippets.

View carltongibson's full-sized avatar
🌳
Pruning branches

Carlton Gibson carltongibson

🌳
Pruning branches
View GitHub Profile
from django import forms
import django_filters
class DateRangeField(django_filters.fields.RangeField):
# Django-Filter DateRangeFilter that really accepts a range of dates ;)
def __init__(self, *args, **kwargs):
fields = (
forms.DateField(),
forms.DateField(),
)
@ptwobrussell
ptwobrussell / gist:668166
Created November 8, 2010 19:52
Visualizing Twitter Search Results:
Visualizing Twitter Search Results with Protovis and/or Graphviz is this easy:
$ easy_install twitter # See https://github.com/sixohsix/twitter and http://pypi.python.org/pypi/setuptools
$ git clone https://github.com/ptwobrussell/Mining-the-Social-Web.git
$ cd Mining-the-Social-Web/python_code
$ python introduction__retweet_visualization.py TeaParty # or whatever you want to search for
Your browser should pop open and display the results as a force directed graph, but also check your console for some useful output.
You can create an image file from the DOT language output with a command like the following:

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

@Abizern
Abizern / .gitignore
Created November 21, 2010 12:45
Global git ignore file
# Mac OS X
*.DS_Store
# Xcode
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
*.xcuserstate
project.xcworkspace/
@stephenemslie
stephenemslie / resolvermatch.py
Created February 3, 2011 12:35
Very simple but useful Django context processor to generate a ResolverMatch object from request.path and add this to the context. Handy in checking for active urls or namespaces.
"""
resolved_pattern Django context processor: insert the current url's ResolverMatch object into context.
Example use: Set class=active to a menu item, based on the namespace of the currently matched url.
<li {% if resolved.namespace == "home" %}class="active"{% endif %}> home </li>
or more specifically:
<li {% if resolved.view_name == "contact" %}class="active"{% endif %}> contact </li>
@mixonic
mixonic / server.js
Created April 28, 2011 22:49
Node.js + Socket.io + Bash. A collaborative terminal for your browser.
//
// This server will start a bash shell and expose it
// over socket.io to a browser. See ./term.html for the
// client side.
//
// You should probably:
//
// npm install socket.io
// curl -O https://github.com/LearnBoost/Socket.IO/raw/master/socket.io.min.js
//
@huobazi
huobazi / gist:997492
Created May 29, 2011 05:09 — forked from dstufft/gist:997475
Configuration Files for Nginx + Gunicorn + Supervisord
We couldn’t find that file to show.
@mattd
mattd / gist:1006398
Created June 3, 2011 14:12
nginx try_files with a proxy_pass
server {
root /var/www/example.com/static;
server_name example.com;
access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.error.log;
try_files /maintenance.html @proxy;
location @proxy {
proxy_pass http://127.0.0.1:10001;
@oaksakal
oaksakal / readme.rst
Created August 13, 2011 08:28 — forked from stefanfoulis/readme.rst
example supervisord script for starting django and gunicorn

example configuration for supervisord

@msmith
msmith / couchdb-ec2-install.sh
Created August 25, 2011 17:26
Set up CouchDB on EC2
#!/bin/bash
#
# This script installs and configures couchdb on a fresh Amazon Linux AMI instance.
#
# Must be run with root privileges
# Tested with Amazon Linux AMI release 2011.02.1.1 (ami-8c1fece5)
#
export BUILD_DIR="$PWD"