$ django-admin.py startproject temp
$ cd temp
temp$ ls
manage.py* temp/
temp$ python manage.py startapp basic
temp$ vi basic/views.py
temp$ mkdir templates
temp$ vi templates/home.html
temp$ vi temp/settings.py
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
tag_types = ['location', 'category'] | |
class Tag(db.Model, BaseEntityMixIn, | |
IgnoreDeletionMixIn): | |
__tablename__ = "tag" | |
name = db.Column(db.Unicode(255), index=True) | |
type = db.Column(db.Enum(*tag_types, native_enum=False), index=True) | |
__mapper_args__ = {'polymorphic_on': type} |
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 flask import * | |
class Recorder(object): | |
def __init__(self): | |
self._record = [] | |
def __getattr__(self, name): | |
def method(*args, **kwargs): | |
if not kwargs and len(args) == 1 and callable(args[0]): | |
def r(target): |
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
main :: IO () | |
main = do | |
let xs = replicate 4 getLine | |
head xs >>= print |
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 sqlalchemy.ext.declarative import declarative_base | |
Base = declarative_base() | |
class Widget(Base): | |
__tablename__ = 'widgets' | |
id = Column(types.BigInteger, primary_key=True) |
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.7.2 (0e28b379d8b3, Feb 09 2012, 18:31:14) | |
[PyPy 1.8.0 with GCC 4.2.1] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
And now for something completely different: ``PyPy is vast, and contains | |
multitudes'' | |
>>>> print True | |
True | |
>>>> print '{0}'.format(True) | |
1 | |
>>>> print '%s' % True |
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 sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy.orm import sessionmaker | |
from sqlalchemy import types | |
from sqlalchemy.schema import Column | |
from sqlalchemy import create_engine | |
Base = declarative_base() | |
class Widget(Base): |
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
module Main where | |
import Data.List (genericLength, genericReplicate) | |
import System.Environment (getArgs, getProgName) | |
import System.Exit (exitSuccess) | |
sierpinskiRows :: Integer -> [String] | |
sierpinskiRows 0 = [] | |
sierpinskiRows 1 = ["*"] | |
sierpinskiRows n |
Find the keyword in http://remix.zedd.net/tracks.
$ easy_install lxml
$ python search_zedd.py tanuki
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 module import class1 | |
>>> # edit and save module.py | |
>>> import module | |
>>> class1 = reload(module).class1 |