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 | |
$states = array( | |
"Alabama" => array("Birmingham", "Montgomery", "Mobile", "Huntsville", "Tuscaloosa"), | |
"Alaska" => array("Anchorage", "Fairbanks", "Juneau", "Sitka", "Ketchikan"), | |
"Arizona" => array("Phoenix", "Tucson", "Mesa", "Chandler", "Scottsdale"), | |
"Arkansas" => array("Little Rock", "Fort Smith", "Fayetteville", "Springdale", "Jonesboro"), | |
"California" => array("Los Angeles", "San Francisco", "San Diego", "San Jose", "Sacramento"), | |
"Colorado" => array("Denver", "Colorado Springs", "Aurora", "Fort Collins", "Lakewood"), | |
"Connecticut" => array("Bridgeport", "New Haven", "Hartford", "Stamford", "Waterbury"), | |
"Delaware" => array("Wilmington", "Dover", "Newark", "Middletown", "Smyrna"), |
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> | |
<script> | |
function handleVisibilityChange() { | |
let videoSelector = document.querySelector('video'); | |
if(document.hidden) { | |
videoSelector.pause(); | |
console.log('Video Paused!!!!'); | |
} else { |
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
$(document).ready(function (e) { | |
let tab = localStorage.getItem('currentTab'); | |
if(tab == 'login'){ | |
$("#tab-item-register").removeClass('show').removeClass('active'); | |
$("#register-tab").attr('aria-selected', false); | |
$("#register-tab").removeClass('active'); | |
}else{ | |
$("#tab-item-login").removeClass('show').removeClass('active'); | |
$("#login-tab").attr('aria-selected', false); | |
$("#login-tab").removeClass('active'); |
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
let vals = []; | |
'["small","medium","large","extra-large"]'.split('"').forEach(function(value){ | |
if(![']', ',' , '['].includes(value)){ | |
vals.push(value); | |
} | |
}); | |
console.log(vals.join(',')); |
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 video = document.querySelector('video'); | |
document.addEventListner('visibilitychange', () => { | |
if(document.hidden){ | |
video.pause(); | |
}else{ | |
video.play(); | |
} | |
}); |
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
bool_list = [True, True, True, True] | |
if all(bool_list): | |
print("All elements are true") | |
else: | |
print("Not all element true") |
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
bool_list = [False, True, False, False] | |
if any(bool_list): | |
print("At least one value should be true") | |
else: | |
print("All 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
#packing | |
*persons, = "hassan", "raza", "dev" | |
print(persons) | |
#output | |
# ["hassan", "raza", "dev"] | |
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 my_kwargs_function(**kwargs): | |
for key, value in kwargs.items(): | |
print(f"{key}: {value}") | |
my_kwargs_function(name="hassan", age="34", city="hobart") | |
#output | |
#name: hassan | |
#age: 34 |
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 my_arg_function(*args): | |
for arg in args: | |
print(arg) | |
my_arg_function("Hassan", "Raza", "Dev") | |
#output | |
# Hassan | |
# Raza |
NewerOlder