Skip to content

Instantly share code, notes, and snippets.

@tabebqena
tabebqena / __init__.py
Last active October 5, 2024 13:11
Turtle race
#
fatha = u'َ'
kasra = u'ِ'
damma = u'ُ'
sukun = u'ْ'
shadda = u'ّ'
doublekasra = u'ٍ'
import datetime
fake_durations = [] # list of durations in seconds
for x in range(0, 1000):
fake_durations.append(1000)
# it is = 1 milion
# 1 milion seconds is more than 11 days.
from datetime import timedelta
durations = [] # list of durations in seconds
for x in range(0, 1000):
durations.append(1000)
# durations now contain 1000 elemnt , each of them = 1000
total_in_seconds = sum(durations)
from datetime import timedelta
durations = [] # list of durations in seconds
for x in range(0, 1000):
durations.append(1000)
# durations now contain 1000 elemnt , each of them = 1000
total_in_seconds = sum(durations)
@tabebqena
tabebqena / app.py
Created June 4, 2021 23:22
improvement of flask class based view
from views2 import View2
from flask import Blueprint, Flask, jsonify, session, abort
import typing as t
app = Flask(__name__)
app.secret_key = "extremely secret"
def auth_required(fn):
def wrap(obj, *args, **kwargs):
function removeElement(id){
document.getElementById(id).parentNode.removeChild(document.getElementById(id));
}
function clearElement(element){
try{
console.info("function: clearElement.\nArguments: "+element)
function getInput(id){
try{
console.info("function: getInput.\nArguments: "+id)
return document.getElementById(id).value;
}
catch(err) {
console.error(err.name , err.message);
function clearDropBtn(id){
try{
document.getElementById(id).options.length = 0;
}catch(err){
console.error(err.name, err.message)
}
}
function clearDropBtnExceptFirst(id){
<style>
html {
max-width:100% ;
min-width:100%
}
#pageBody {direction:rtl;
font-size:17px;
line-height:1.2;