tornado web
source
requie
- tornado >= 3.1
- python >= 2.7
- pymongo >= 2.7.1
- pyjade >= 2.2.0
- supervisord >= 3.0
code
less but readable
virtualenv(wrapper)
tutorial virtualfish pythonz pythonbrew
auto switch python environment
source /usr/local/bin/virtualenvwrapper.sh
mkvirtualenv --no-site-packages --distribute -p /usr/local/bin/python3 tornadev
pip install -r requirements.txt
#!/bin/bash
VENV=$1
if [ -z $VENV ]; then
echo "usage: runinenv [virtualenv_path] CMDS"
exit 1
fi
. ${VENV}/bin/activate
shift 1
echo "Executing $@ in ${VENV}"
exec "$@"
deactivate
# /etc/supervisord.conf
[program:app]
command=sh path/to/run.sh ./.venv python boot.py
directory=/path/to/Project
autostart=true
autorestart=true
startsecs=10
mongodb
- schemeless
- bson
javascript
- coffeescript.org
- type-script
# Assignment:
number = 42
opposite = true
# Conditions:
number = -42 if opposite
# Functions:
square = (x) -> x - x
# Arrays:
list = [1, 2, 3, 4, 5]
oocss
- lesscss.org
- sacss, compass
select {
foo1: bar1;
}
select sub {
foo2: bar2;
}
select {
foo1: bar1;
sub {
foo2: bar2;
}
}
template
- jade pyjade
- handlebars
- mustache.js
!!! 5
html(class=html_cls(__name__))
head
meta(chaset='utf-8')
meta(name="viewport", content="width=device-width, initial-scale=1.0")
link(rel="stylesheet", type="text/css", href=static_url('build/build.css'))
link(rel="stylesheet", type="text/css", href=static_url('pure-min.css'))
link(rel="stylesheet", type="text/css", href=static_url('pure.css'))
script(type="text/javascript", src=static_url("build/build.js"))
body
.pure-g-r#layout
header.pure-u#menu
.pure-menu.pure-menu-open
a.pure-menu-heading(href="/")= _('Dashboard')
ul
each name in ['issue', 'index', 'article', 'analyze']
li
a(href="/"+name+"/", class=name)= name
- var user = handler.current_user
if user
p= user.split('@')[0]
a(href="/auth/logout")= 'Sign Out'
div.pure-u#main
block content
tmux
- more than screen
- split panel
- session
- vi/emacs keybind
- copy/paste buffer (mouse support)
vim
Bundle 'gmarik/vundle'
Bundle 'scrooloose/syntastic'
Bundle 'majutsushi/tagbar'
Bundle "groenewege/vim-less"
Bundle "wavded/vim-stylus"
Bundle "kchmck/vim-coffee-script"
Bundle 'jade.vim'
au bufwritepost *.less silent execute '!lessc % > %:t:r.css'
au bufwritepost *.styl silent execute '!stylus --compress < % > %:t:r.css'
au bufwritepost *.coffee silent execute '!coffee -cm %'
linux container
vagrant init precise32 http://files.vagrantup.com/precise32.box
vagrant up
vagrant ssh