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
Realworldish Benchmark: | |
jinja 0.0009 seconds | |
mako 0.0008 seconds | |
django 0.0067 seconds | |
genshi 0.0144 seconds | |
(venv)slava@slava-air ~/src/jinja2/examples/rwbench $ python rwbench.py | |
Realworldish Benchmark: | |
jinja 0.0013 seconds | |
mako 0.0012 seconds | |
django 0.0066 seconds |
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 import create_engine, Column, Integer, MetaData, Table, String | |
from sqlalchemy.sql import select, Select, ColumnCollection | |
engine = create_engine('sqlite:///:memory:', echo=True) | |
metadata = MetaData() | |
class RearrangeSelect(Select): |
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 Flask, render_template | |
app = Flask(__name__) | |
@app.route('/') | |
def hello_world(): | |
return render_template('test.txt') | |
if __name__ == '__main__': | |
app.jinja_env.add_extension('jinja2.ext.do') | |
app.run(debug=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
import sys | |
from sqlalchemy import create_engine, Column, Integer, Index, event | |
from sqlalchemy.ext.declarative import declarative_base, declared_attr | |
engine = create_engine('postgresql://slava:slavapw@localhost:5432/test', echo=True) | |
Base = declarative_base() | |
class BaseModel(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 Utf8 where | |
import qualified Data.ByteString as B | |
import Control.Applicative | |
import Data.Word | |
import Data.Bits | |
import Data.Char | |
import Debug.Trace | |
utf8SeqInfo :: Word8 -> Maybe (Word8, Word8) |
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
>>> a = "realylongstringwithmanychars" | |
>>> b = "realylongstringwithmanychars" | |
>>> a is b | |
True | |
>>> a = "a b c" | |
>>> b = "a b c" | |
>>> a is b | |
False |
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
#!/bin/bash | |
XONOTIC_LINUX=xonotic-glx | |
XONOTIC_OSX="open $HOME/Downloads/Xonotic/Xonotic.app -W --args" | |
XONOTIC_DATA_LINUX=$HOME/.xonotic/data | |
XONOTIC_DATA_OSX="$HOME/Library/Application Support/xonotic/data" | |
realpath() { | |
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" |
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.Array.IArray | |
import Data.Tuple (swap) | |
import System.Random | |
import Data.List (foldl') | |
data CoinType = Gold | |
| Silver | |
deriving(Show, Read, Eq, Ord, Bounded, Enum) |
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
class AbsractDelModel(Model): | |
is_deleted = BoleanField(default = False) | |
class Meta: | |
abstract = True | |
class ArchesModel(Model): | |
name = CharField() |
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
port_tree = PortageTree() | |
for package in port_tree.iter_packages(): | |
for ebuild in package.iter_ebuilds(): | |
ebuild.get_info() # get info about ebuild |
OlderNewer