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
Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51) | |
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
(InteractiveConsole) | |
>>> from django.contrib.sites.models import Site | |
>>> from reversion.models import Revision, Version | |
>>> from reversion import revision | |
>>> revision.register(Site) | |
>>> @revision.create_on_success | |
... def foo(): |
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
"""Thumbnail generation routines.""" | |
import collections, os | |
from PIL import Image #@UnresolvedImport | |
from django.core.files.storage import default_storage | |
from django.utils import html |
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
import qualified Data.Map as Map | |
{- Supported HTTP methods. -} | |
data HttpMethod = GET | POST deriving (Read, Show) | |
{- A parsed HTTP request. --} |
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
import sys, itertools | |
# Supported HTTP methods. | |
GET = "GET" | |
POST = "POST" | |
# A parsed HTTP request. |
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 _gaq = _gaq || []; | |
_gaq.push(['_setAccount', 'UA-XXXXX-X']); | |
_gaq.push(['_trackPageview']); | |
_gaq.push(['_addTrans', | |
'1234', // order ID - required | |
'Acme Clothing', // affiliation or store name | |
'11.99', // total - required | |
'1.29', // tax | |
'5', // shipping | |
'San Jose', // city |
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 _gaq = _gaq || []; | |
_gaq.push(['_setAccount', 'UA-XXXXX-X']); | |
_gaq.push(['_trackPageview']); | |
_gaq.push(['_addTrans', | |
'<?php echo $orderId; ?>', // order ID - required | |
'<?php echo $storeName; ?>', // affiliation or store name | |
'<?php echo $total; ?>', // total - required | |
'<?php echo $tax; ?>', // tax | |
'<?php echo $shipping; ?>', // shipping | |
'<?php echo $city; ?>', // city |
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
-- Quick and dirty solution | |
sum [n | n <- [1..999], n `mod` 3 == 0 || n `mod` 5 == 0] | |
-- Better, more efficient solution | |
sum [1,3..999] + sum [1,5..999] + sum[1,15..999] |
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
let fibs = 0 : 1 : zipWith (+) fibs (tail fibs) in sum $ takeWhile (<4000000) $ filter (even) fibs |
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
foldr1 (max) $ filter (\p -> let s = show p in s == reverse s) [ n * m | n <- [1..999], m <- [1..999]] |
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
foldr1 (+) $ map (\d -> read [d]) $ show $ foldr1 (*) [1..100] |
OlderNewer