This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/> | |
</head> | |
<body> | |
<form action="" method="GET"> | |
<input type="text" /> | |
<input type="submit" /> | |
</form> | |
<script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from google.appengine.api import images | |
from google.appengine.api import urlfetch | |
from google.appengine.ext import webapp | |
from google.appengine.ext import blobstore | |
from google.appengine.ext.webapp import blobstore_handlers | |
PAYLOAD_TEMPLATE = \ | |
"""--==boundary\r | |
Content-Disposition: form-data; name="file"; filename="%s"\r |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#iphone-icon { | |
-webkit-border-radius: 8px; | |
-webkit-box-shadow: rgba(0, 0, 0, 0.796875) 0px 1px 2px; | |
background: -webkit-gradient(radial, 28 -20, 50, 28 -20, 51, | |
from(transparent), | |
to(rgba(0, 0, 0, 0.0976562))), | |
-webkit-gradient(radial, 28 -50, 50, 28 -50, 80, | |
from(rgba(255, 255, 255, 0.796875)), | |
to(rgba(255, 255, 255, 0))), | |
url({{ image }}) no-repeat 0% 0%; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
var script = '<script type="text/javascript" src="http://m.com/static/tests/test-wired.js"></script>'; | |
var host = "www.wired.com"; | |
var headTagRe = /<head.*?>/i; | |
var htmlContentTypeRe = /text\/html/; | |
http.createServer(function (req, res) { | |
var client = http.createClient(80, host); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.http import HttpRequest, HttpResponse | |
from django.contrib.auth import login, get_backends | |
from django.contrib.auth.models import User | |
from django.contrib.sessions.middleware import SessionMiddleware | |
user = User.objects.filter(is_superuser=True, is_active=True)[0] | |
request = HttpRequest() | |
middleware = SessionMiddleware() | |
middleware.process_request(request) | |
backend = get_backends()[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(), | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add orientation body class. | |
window.addEventListener("DOMContentLoaded", function(){ | |
var cls = ["landscape", "portrait"]; | |
var clsRe = new RegExp("(" + cls.join("|") + ")"); | |
var event = "onorientationchange" in window ? "orientationchange" : "resize"; | |
document.body.className += " " + getClass(); | |
window.addEventListener(event, function(){ | |
var className = document.body.className; | |
document.body.className = className ? className.replace(clsRe, getClass()) : getClass(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from django.db.models.signals import post_save | |
from django.dispatch import Signal | |
# TODO: Better call for storing the val. | |
# TODO: Could you use a function to store the old state? | |
# TODO: Does this even really belong in the app? Noooo... | |
# Should be some way to spec. which model is the Thread/Post. | |
# TODO: This use a better name. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def roles(role): | |
def do_roles(func): | |
def wrapper(*args, **kwargs): | |
if env.host in env.roledefs[role]: | |
return func(*args, **kwargs) | |
return wrapper | |
return do_roles |