Skip to content

Instantly share code, notes, and snippets.

View brent-hoover's full-sized avatar
🏠
Working from home

Brent Hoover brent-hoover

🏠
Working from home
View GitHub Profile
"""
Tasks for managing a test server
"""
import os
from fabric.api import cd, env, prefix, run, sudo, task
from fabric.contrib.files import exists, sed
from fabric.context_managers import hide
from fabric.colors import green, red
#!/usr/bin/env python
## WARNING: This file is generated
#!/usr/bin/env python
"""Create a "virtual" Python installation
"""
# If you change the version here, change it in setup.py
# and docs/conf.py as well.
virtualenv_version = "1.6.3"
"""
jQuery templates use constructs like:
{{if condition}} print something{{/if}}
This, of course, completely screws up Django templates,
because Django thinks {{ and }} mean something.
Wrap {% verbatim %} and {% endverbatim %} around those
blocks of jQuery templates and this will try its best
# Copyright 2012 Erlware, LLC. All Rights Reserved.
#
# This file is provided to you under the Apache License,
# Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,

Types of index scans

Indexes

Sequential Scan:

  • Read every row in the table
  • No reading of index. Reading from indexes is also expensive.
# -*- coding: utf-8 -*-
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Div, Submit, HTML, Button, Row, Field
from crispy_forms.bootstrap import AppendedText, PrependedText, FormActions
class MessageForm(forms.Form):
text_input = forms.CharField()
@brent-hoover
brent-hoover / general_lib.txt
Created October 29, 2012 14:31 — forked from matthusby/general_lib.erl
Common Erlang Functions
-module(general_lib).
-compile(export_all).
-define(SECRET, "SOMETEXTHERE").
time_as_string() ->
{MegaSeconds, Seconds, MicroSeconds} = erlang:now(),
integer_to_list(MegaSeconds) ++ integer_to_list(Seconds) ++ integer_to_list(MicroSeconds).
time_as_seconds() ->
@brent-hoover
brent-hoover / evproxy.coffee
Created September 7, 2012 14:27
simple node.js event proxy that pipes rabbitmq messages to websockets
class EventProxy
@socket: null
@amqp: null
constructor: (socket, amqp) ->
@socket = socket
@amqp = amqp
@amqp.on 'ready', @ready
ready: =>
@brent-hoover
brent-hoover / gist:1341100
Created November 5, 2011 04:13 — forked from stephenmcd/gist:1341065
Trap every object method
class Foo(object):
def __getattribute__(self, name):
attr = object.__getattribute__(self, name)
if callable(attr):
def wrapper(*args, **kwargs):
try:
return attr(*args, **kwargs)
except Exception, e:
print "%s failed with exc %s" % (name, e)