Skip to content

Instantly share code, notes, and snippets.

View ebysofyan's full-sized avatar
🚀
Work from anywhere

Eby Sofyan ebysofyan

🚀
Work from anywhere
View GitHub Profile
String hello = "Hello Dunia";
String nama = "Eby Sofyan";
int angkaSepuluh = 10;
getProgress = (taskId, progressBarId, progressBarMessageId, isDownloadFile = false) => {
var progressUrl = `{% url 'progress' %}?task_id=${taskId}`;
function onExportUserProgress(progressBarElement, progressBarMessageElement, progress) {
progressBarMessageElement.innerHTML = `Progress ${progress.percent}% . . .`
progressBarElement.setAttribute("style", `width: ${progress.percent}%`)
progressBarElement.setAttribute("aria-valuenow", progress.percent)
}
function onExportUserSuccess(progressBarElement, progressBarMessageElement, result) {
alert("Complete progress 100%")
from dj_celery_progress_sample import celery_app
# Celery task function base
@celery_app.task(bind=True)
def count_thousand_number():
for i in range(0, 1000):
print("Current index is : %s" % i)
return "Complete count thousand times"
# write this in celeryconfig.py
import os
import tempfile
broker_url = "redis://localhost:6379/0"
result_backend = "redis://localhost:6379/0"
accept_content = ["pickle", "json", "msgpack", "yaml"]
task_ignore_result = False
def the_magic_of_python(*args, **kwargs):
still_learn = bool((args[0] and args[1]) == True)
if still_learn:
learn_python = kwargs.get("learn_python")
print(learn_python)
else:
lets_try_python = kwargs.get("lets_try_python")
print(lets_try_python)
args_params = (True, False)
def the_magic_of_python(*args, **kwargs):
print("This is args values : %s" % str(args))
print("This is kargs values : %s" % str(kwargs))
the_magic_of_python(True, False, first=15, second=26)
def the_magic_of_python(*args, **kwargs):
print("The first value of kwargs is : %s" % kwargs.get("first"))
print(kwargs)
the_magic_of_python(True, False, first=15, second=26)
def the_magic_of_python(*args, **kwargs):
print(type(kwargs))
the_magic_of_python(True, False, first=15, second=26)
def the_magic_of_python(*args, **kwargs):
for i, arg in enumerate(args):
print("This is the %s parameter, value %s" % (i, arg))
the_magic_of_python(True, False, 1, 2, 3)
def the_magic_of_python(*args, **kwargs):
print("The first args parameter is : %s" % args[0])
print(args)
the_magic_of_python(1,2,3,4,5)