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 re | |
from email import parser, message | |
from email.header import decode_header | |
class EmlParser(object): | |
def __init__(self, email: bytes): | |
self.parsed = parser.BytesParser().parsebytes(email) | |
def file_name_extractor(self, text): |
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 url("../fonts/css/fontiran.css"); | |
html { | |
direction: rtl; | |
font-family: IRANSans; | |
} | |
.sidebar { | |
right: 0 !important; | |
left: auto !important; |
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 asynchat | |
import base64 | |
import ssl | |
import asyncore | |
from smtpd import SMTPServer as BaseSMTPServer, SMTPChannel as BaseSMTPChannel, DEBUGSTREAM | |
def decode_b64(data): | |
"""Wrapper for b64decode, without having to struggle with bytestrings.""" |
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 base64 | |
from django.core.files.base import ContentFile | |
from rest_framework import serializers | |
class Base64ImageField(serializers.ImageField): | |
def to_internal_value(self, data): | |
if isinstance(data, basestring) and data.startswith('data:image'): | |
# base64 encoded image - decode |
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 zeep import helpers, Client | |
import types | |
class SoapConnector(object): | |
def __init__(self, base_url): | |
self._client = Client(base_url) | |
def send(self, method, data): | |
connector = getattr(self._client.service, method) |
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 is_date_time($value){ | |
if (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])[T|\s]{1}([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$/",$value)) | |
{ | |
return true; | |
}else{ | |
return 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
import time | |
import threading | |
class BaseThread(threading.Thread): | |
def __init__(self, callback=None, callback_args=None, *args, **kwargs): | |
target = kwargs.pop('target') | |
super(BaseThread, self).__init__(target=self.target_with_callback, *args, **kwargs) | |
self.callback = callback | |
self.method = target |
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
String.prototype.replaceAll = function(search, replacement) { | |
var target = this; | |
return target.replace(new RegExp(search, 'g'), replacement); | |
}; | |
String.prototype.toPersianCharacter = function () { | |
var string = this; | |
var obj = { | |
'ك' :'ک', | |
'دِ': 'د', |
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
String.prototype.replaceAll = function(search, replacement) { | |
var target = this; | |
return target.replace(new RegExp(search, 'g'), replacement); | |
}; | |
/** | |
* Example | |
*/ |
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
<?php | |
public static function arabicToPersian($string) | |
{ | |
$characters = [ | |
'ك' => 'ک', | |
'دِ' => 'د', | |
'بِ' => 'ب', | |
'زِ' => 'ز', | |
'ذِ' => 'ذ', | |
'شِ' => 'ش', |