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
{setup:"Our wedding was so beautiful,",punchline:"even the cake was in tiers"},{setup:"I'm reading a book on the history of glue",punchline:"I just can't seem to put it down"},{setup:"What do you call an Argentinian with a rubber toe?",punchline:"Roberto"},{setup:"I am terrified of elevators,",punchline:"I'm going to start taking steps to avoid them"},{setup:"Why do crabs never give to charity?",punchline:"Because they're shellfish."},{setup:"Why don't skeletons ever go trick or treating?",punchline:"Because they have no body to go with"},{setup:"What do you call cheese by itself?",punchline:"Provolone"},{setup:'"Ill call you later."',punchline:"Don't call me later, call me Dad"},{setup:"Dad, I'm hungry.",punchline:"Hello, Hungry. I'm Dad"},{setup:"Where does Fonzie like to go for lunch?",punchline:"Chick-Fil-Eyyyyyyyy"},{setup:"Did you hear about the cheese factory that exploded in France?",punchline:"There was nothing left but de Brie"},{setup:"I knew I shouldn’t have had the seafood",punchline:"I’m feeling |
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 compiled = _.template("hello: <%= name %>"); | |
compiled({name : 'moe'}); | |
=> "hello: moe" | |
var list = "<% _.each(people, function(name) { %> <li><%= name %></li> <% }); %>"; | |
_.template(list, {people : ['moe', 'curly', 'larry']}); | |
=> "<li>moe</li><li>curly</li><li>larry</li>" |
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 locations = [[37,-122],[38,-121],[39,-120]], // An array of arrays of [ lat , lng ]. You'll find the closest to target | |
target = [37.75,-121], // starting point | |
radians = function (deg) { | |
return Math.PI*deg/180; // needed function not native to JavaScript's Math object | |
}; | |
function getDistances (target, locations) { | |
var spots = []; | |
for (var i=0;i<locations.length;i++) { | |
var distance = 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
# Place in models.py | |
class ExternalLink(db.Item): | |
title = db.NameProperty() | |
href = db.LinkProperty(verbose_name='Link') | |
@site.item_view.define(ExternalLink) | |
def link_view(item, request): | |
return http.HttpResponseRedirect(item.href) |
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 re import sub | |
from django import template | |
register = template.Library() | |
@register.filter(name='cleanhtml') | |
def cleanhtml(value): | |
'''Removes inline styles from WYSIWYG-generated markup.''' | |
return sub('(\s?style\s?=\s?[\'\"].+[\'\"])', '', str(value)) |
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 re import sub | |
from django import template | |
register = template.Library() | |
@register.filter(name='cleanhtml') | |
def cleanhtml(value): | |
"""Removes all attributes from all HTML tags, but keeps <img> tags intact. | |
Ideal for cleaning WYSIWYG-generated mess.""" | |
return sub('(<\w+(\ssrc=[\'"][\w:/\.-]+[\'"])?)[^>(/>)]*(>)', r'\1\2', str(value)) |
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
.clearfix { | |
line-height: 1px; | |
height: 1px; | |
width: auto; | |
clear: both; } |
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 main(): | |
import csv, sys, re | |
from pykk.message import site, db | |
from yourapp.apps.models import YourModel # import your relevant models | |
db.initialize() | |
reader = csv.DictReader(open(sys.argv[1])) | |
with db.transaction('Importing Employees'): | |
for row in reader: |
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
/* grids */ | |
@media screen and (max-width: 319px) {.unit { float: none !important; width: auto !important;} | |
} | |
.line:after,.lastUnit:after { clear: both; display: block; visibility: hidden; overflow: hidden; height: 0 !important; line-height: 0; font-size: xx-large; content: " x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x ";} | |
.line {*zoom:1;} | |
.unit { float: left;} | |
.size1of1 { float: none;} | |
.size1of2 { width: 50%;} | |
.size1of3 { width: 33.33333%;} | |
.size2of3 { width: 66.66666%;} |
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
# change directory to the base of your project | |
# Your project base is the directory that contains | |
# either _darcs or .git or .hg | |
# to use as a command add to .zshrc or .bashrc | |
# alias base='source <path/to/base.sh> | |
CUR=$(pwd); | |
while [ ! "$CUR" = "/" ] |
OlderNewer