Skip to content

Instantly share code, notes, and snippets.

from django.db import models
from django.core.exceptions import ImproperlyConfigured
from django import forms
from django.conf import settings
try:
from keyczar import keyczar
except ImportError:
raise ImportError('Using an encrypted field requires the Keyczar module. You can obtain Keyczar from http://www.keyczar.org/.')
@robrocker7
robrocker7 / iptables.sh
Created December 11, 2012 16:41 — forked from bzerangue/iptables.sh
iptables
#!/bin/sh
#
# Jonathan Perkin <[email protected]> wrote this file.
#
# You can freely distribute/modify it (and are encouraged to do so),
# and you are welcome to buy me a beer if we ever meet and you think
# this stuff is worth it. Improvements and cleanups always welcome.
#
# IPTables firewall script. There are many. This is mine.
#
<!doctype html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7 ]> <html class="no-js ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]> <html class="no-js ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]> <html class="no-js ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="HandheldFriendly" content="True">
<!DOCTYPE html>
<html>
<head>
<title>Home</title>
<meta name="description" content=''/>
<link href="/static/libs/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="/static/libs/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
# http://www.protectamerica.com/contact/affiliate-program/
class Profile(models.Model):
PROFILE_STATUS = (
('DECLINED', 'Declined'),
('APPROVED', 'Approved'),
('PENDING', 'Pending')
)
var Cart = function(cookie_name, equipment_total_class, monthly_total_class, equipment_breakdown_class, current_equ) {
this.cookie_name = cookie_name;
this.cart = getCookie(this.cookie_name);
if(!this.cart) {
this.reset();
}else{
this.cart = JSON.parse(this.cart);
}
this.equipment_total_class = equipment_total_class;
this.monthly_total_class = monthly_total_class;
import httplib, urllib
from django.utils import simplejson
"""
curl -s --insecure -H "X-PAYPAL-SECURITY-USERID: Your_API_username"
-H "X-PAYPAL-SECURITY-PASSWORD: Your_API_password"
-H "X-PAYPAL-SECURITY-SIGNATURE: Your_API_signature"
-H "X-PAYPAL-REQUEST-DATA-FORMAT: NV"
-H "X-PAYPAL-RESPONSE-DATA-FORMAT: NV"
<VirtualHost 000.000.000.000:80>
ServerName brandname.com
ServerAlias www.brandname.com
DocumentRoot /path/to/htdocs
ErrorLog /path/to/logs/error_log
TransferLog /path/to/logs/access_log
Alias /favicon.ico /path/to/favicon.ico
Alias /django-media/ "/path/to/app/media/"
Alias /static/ "/path/to/app/static/"
@robrocker7
robrocker7 / views.py
Created September 7, 2012 16:00
example custom view
def index(request):
ctx = {}
ctx['page_name'] = 'index'
ctx['pages'] = ['index']
latest_news = Article.objects.order_by('-date_created')[:3]
ctx['latest_news'] = latest_news
return simple_dtt(request, 'index.html', ctx)
@robrocker7
robrocker7 / index.html
Created September 7, 2012 15:54
Example of site2/index.html
{% extends "base.html" %}
{% load content_filters content_tags sekizai_tags testimonial_tags %}
{% block page_title %}2nd amazing title tag!{% endblock %}
{% block css %}
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/affiliates/sem-landing-page/home.css" />
{% endblock %}