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
package models | |
import javax.persistence.* | |
@Entity (name="Agreement") | |
@Table (name="agreement") | |
@EntityListeners ([QIdSetter.class]) | |
class AgreementJpaImpl extends QIdEntityImpl implements Agreement { | |
@ManyToOne (targetEntity=PartyJpaImpl.class) |
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
""" | |
SQLAlchemy Enum type based on Integer indices. | |
""" | |
from sqlalchemy import types | |
class Enum(types.TypeDecorator): | |
impl = types.Integer | |
def __init__(self, value_map, strict=True, *args, **kw): | |
"""Emulate Enum type with integer-based indexing. |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> | |
<head> | |
<title>Textshortening and ellipsis with only CSS</title> | |
<meta http-equiv="content-type" content="text/html;charset=utf-8" /> | |
<style type="text/css"> | |
p { | |
width: 220px; | |
line-height: 18px; |
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 referenceClosure = { | |
html { | |
body { | |
h1 "hello" | |
} | |
} | |
} | |
def markupBuilder(closure) { |
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/sh | |
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the | |
# CREATE block and create them in separate commands _after_ all the INSERTs. | |
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk. | |
# The mysqldump file is traversed only once. | |
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite | |
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite |
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
<html> | |
<head> | |
<script src="./leaflet.js"></script> | |
<script> | |
window.onload = function() { | |
var myCrs = L.Util.extend({}, L.CRS, { | |
projection: L.Projection.LonLat, | |
transformation: new L.Transformation(1, 0, 1, 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
function FindProxyForURL(url, host){ | |
var myip = myIpAddress(); | |
var ipbits = myip.split("."); | |
var myseg = parseInt(ipbits[3]); | |
if(myseg == Math.floor(myseg/2)*2){ | |
proxy = 'PROXY 165.225.131.153:80; PROXY 165.225.130.193:80'; | |
} else { | |
proxy = 'PROXY 165.225.130.193:80; PROXY 165.225.131.153:80'; | |
} | |
if((host == 'localhost')||(shExpMatch(host, 'localhost.*'))||(shExpMatch(host, '*.local'))||(host == '127.0.0.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
# -*- coding: utf-8 -*- | |
""" | |
flask-admin and "The Enum Recipe" | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
Adds flask-admin support for the enum recipe on zzzeek's blog_. | |
This code is specific to SQLAlchemy. | |
.. _blog http://techspot.zzzeek.org/2011/01/14/the-enum-recipe/ |
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
_slugify_strip_re = re.compile(r'[^\w\s-]') | |
_slugify_hyphenate_re = re.compile(r'[-\s]+') | |
def slugify(value): | |
""" | |
Normalizes string, converts to lowercase, removes non-alpha characters, | |
and converts spaces to hyphens. | |
From Django's "django/template/defaultfilters.py". | |
""" | |
import unicodedata |
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
# -*- coding: utf-8 -*- | |
from __future__ import unicode_literals | |
import mimetypes | |
from optparse import make_option | |
from django.utils.encoding import force_text | |
from django.utils.translation import ugettext as _ | |
from django.core.management.base import BaseCommand |
OlderNewer