Skip to content

Instantly share code, notes, and snippets.

View syedjafer's full-sized avatar
🎯
Focusing

syedjafer_k syedjafer

🎯
Focusing
View GitHub Profile
class Customer:
def __init__(self, address, title, first_name, last_name):
self.__address = address
self.__title = title
self.__first_name = first_name
self.__last_name = last_name
def get_title(self):
return self.__title
// setItem normal strings
window.sessionStorage.setItem("name", "goku");
// getItem
const name = window.sessionStorage.getItem("name");
console.log("name from localstorage, "+name);
// Storing an Object without JSON stringify
const data = {
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Simple 404 Page</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<style>
.page_404 {
padding: 40px 0;
def binary_search(arr, key, start, end):
if start == end:
if arr[start] > key:
return start
else:
return start+1
if start > end:
return start
// setItem normal strings
window.localStorage.setItem("name", "goku");
// getItem
const name = window.localStorage.getItem("name");
console.log("name from localstorage, "+name);
// Storing an Object without JSON stringify
const data = {
const data = [5, 4, 3, 2, 1];
// Usage 1 -
data.forEach(val => console.log("Usage 1", val));
// Usage 2 - Mutating(changing the array value inplace)
data.forEach((val, index) => {
data[index] = val * val;
})
console.log("Inplace value changes, ", data);
def selection_sort(array, size):
for itr in range(size):
min_index = itr
for ctr in range(itr + 1, size):
if array[ctr] < array[min_index]:
min_index = ctr
array[itr], array[min_index] = array[min_index], array[itr]
arr = [29,10,14,37,14]
# Receiver
class Volume:
def __init__(self, volume=0):
self.volume = volume
def volume_up(self, value=1):
self.volume += value
print(f"Volume is Up - {self.volume}")
def volume_down(self, value=1):
from celery import signature
from celery import Celery
import json
app = Celery(name="tasks",
broker="redis://localhost:6379/0",
backend="db+sqlite:///db+sqlite3"
)
@app.task
from celery import signature
from celery import Celery
import json
app = Celery(name="tasks",
broker="redis://localhost:6379/0",
backend="db+sqlite:///db+sqlite3"
)
@app.task