Skip to content

Instantly share code, notes, and snippets.

@enagorny
enagorny / gist:2133997
Created March 20, 2012 10:33
converts western digits to arabic equivalent UTF8
def translate_to_ar_numbers(num):
"""
Translates western digits in string to their correspondings arabic equivalent
All other characters stays the same
Args:
num: number or string with numbers where we need to replace digits
Returns:
unicode string with replaced to arabic digits
for example: u'٢٢٠-٢٤٠' -- for num="220-240"
"""
@enagorny
enagorny / To_ar_num.py
Created February 2, 2012 13:48
converts western digits to arabic equivalent
def translate_to_ar_numbers(num):
"""
Translates western digits in string to their correspondings arabic equivalent
Args:
num: number or string with numbers where we need to replace digits
Returns:
unicode string with replaced to arabic digits
for example: u'\xd9\xd9\xd9-\xd9\xd9\xd9' -- for num="220-240"
u'\xa3\xa2\xd9.\xd9\xa2' -- for num="750.45"
"""
@enagorny
enagorny / gist:1626212
Created January 17, 2012 10:55
JS GET parameters as dict
function urlGET(){
var search = window.location.search.replace('?', '').split('&');
var GET = new Array();
for(var i=0; i<search.length; i+=1){
search[i] = search[i].split('=');
GET[decodeURIComponent(search[i][0])] = decodeURIComponent(search[i][1]);
};
return GET;
};