Skip to content

Instantly share code, notes, and snippets.

Async calls

<template>
<!-- 
When isLoading is true, the <div> is in the DOM, the <p> is not.
When isLoading is false, Vue will remove the <div> and add the <p> to the DOM,
at which point <MyComponent> will be created and passed the fetched data.
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
* {
margin: 0;
padding: 0;
@master-stm
master-stm / todoApp.index
Created September 14, 2020 02:27
one page todo app
<!doctype html>
<html lang="en">
<head>
<title>Todo App</title>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
@master-stm
master-stm / CSS3 Media Queries Template
Created June 9, 2020 16:05
CSS3 Media Queries template
/*
* Author: http://stuffandnonsense.co.uk/blog/about/hardboiled_css3_media_queries/
*/
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
@master-stm
master-stm / plus one problem.py
Last active April 9, 2020 14:47
a solution to the plus one problem
'''
given an array of integers that represents the digits of
a positive integers, you are asked to add 1 to it and return
the new value of the array'''
# input: [2, 3, 6] => output: [2, 3, 7]
# input: [2, 9, 9] => output: [3, 0, 0]
# code starts here #
@master-stm
master-stm / steam_scraping.py
Created April 3, 2020 14:51
scraping steam to get recent top sellers specials + converting currency
from bs4 import BeautifulSoup
import html5lib
from pip._vendor import requests
myURL = requests.get("https://store.steampowered.com/search/?filter=topsellers&specials=1")
soup = BeautifulSoup(myURL.text, "html5lib")
for game in soup.find_all("div", class_="responsive_search_name_combined"):
game_title = game.find('span', class_="title").text.rstrip()
game_discount = abs(int(game.find('div', class_="col search_discount responsive_secondrow").text.lstrip().rstrip().strip('%')))
@master-stm
master-stm / createAteam.py
Created February 9, 2020 14:53
Takes a number from user and create a list with user's input. takes names from user and creates a team randomly
import random
n = int(input("How many players? "))
players_list = []
for i in range(n):
name= input(f"Enter player no. {i+1} : ")
players_list.append(name)
d = int(len(players_list)/2)
print(random.choices(players_list, k=d))
@master-stm
master-stm / username_password_check.py
Created November 13, 2019 15:04
a quick python code to check username and password
username = "master stm"
password = "leader.3"
user_input = input("enter username: ")
if user_input == username :
user_password = input("enter password: ")
if user_password == password :
print(f"Welcome Back {username}")
else:
print("password is not recognized")
else:
@master-stm
master-stm / image_carousel_pro.dart
Created October 16, 2019 23:20 — forked from Blasanka/image_carousel_pro.dart
This is a code snippet to elaborate how to use image carousel pro package with dot indicator. You can find the package here: https://pub.dartlang.org/packages/carousel_pro. Note: there are so many image carousel packages that you can try, I have chosen this because I dont want to separately add dot indicator by the time I'm creating this snippet.