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
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 |
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
// 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 = { |
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
<!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/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> | |
<style> | |
.page_404 { | |
padding: 40px 0; |
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
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 | |
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
// 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 = { |
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
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); |
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
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] |
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
# 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): |
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 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 |
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 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 |