Skip to content

Instantly share code, notes, and snippets.

@Natim
Natim / language_app.py
Created August 18, 2012 08:40
Flask language_dispatch : Detect the user language and redirect to the right domain_name
# -*- coding: utf-8 -*-
import locale
import re
from flask import Flask, redirect, request
app = Flask(__name__)
LANGUAGE_CODES = ('fr', 'en', 'zh')
DOMAIN_NAME = 'example.com'
@mwgamera
mwgamera / ver36.js
Created July 18, 2011 06:09
Alphanumeric derivative of Verhoeff check digit in javascript.
var Ver36 = function() {
"use strict";
var N = 18, N2 = N*2;
var d18_op; // D18 group operation table
var d18_inv; // D18 group inverse
var perm; // the permutation decomposed into cycles
var a2i,i2a; // ASCII translation tables
var NA=0xff; // invalid digit marker in ASCII table
// initialization code