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
<template> | |
<ICountUP | |
v-if="loaded" | |
:delay="delay" | |
:endVal="shortNum" | |
:options="options" /> | |
// use a question mark until the number loads, a loading animation would be cool also | |
<div v-else>?</div> | |
</template> |
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
// this very simple example is referencing bootstrap, but the method will be the same if using other presentation frameworks | |
<template> | |
<div> | |
<div class="floating-form mx-auto"> | |
// create a simple input field, but bound the imput to data property with v-model | |
<input id="emailaddress" type="email" class="form-control" aria-describedby="email" placeholder="Your Email Address" v-model="mailAddress" /> | |
// create a button that has an @click function, and where disabled is bound to the email_isValid computed property - this means the user will not be able to click when the email is not determined to be valid by the regular expression evaluation | |
// note that the boolean is flipped here using a '!', this is so that when the email not yet entered or evaluated as invalid the expected value of false, gets set to true to enable the 'disabled' attribute - and vice versa | |
<b-button @click="submitemail" :disabled="!email_isValid" /> | |
</div> |
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
# Assumptions; | |
# you have are working with CSVs that include useful headers | |
# you are using the 'inferSchema' option when reading those CSVs to DataFrames | |
# you are writing/updating Delta Tables with those DataFrames | |
import pandas as pd | |
import pyspark.sql.functions as F | |
# change other date formats to strings, useful if you get out of bounds errors when casting timestamp[tz, etc.] to timestamp[n] | |
def date_to_string(df: DataFrame) -> DataFrame: |
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 PIL import Image | |
from PIL.ExifTags import TAGS | |
import os | |
# ask for image path | |
accepted_exts = ['jpg', 'jpeg', 'png', 'gif'] | |
# exits if path not found | |
img_path = input('please provide path and hit enter: ') | |
if not os.path.exists(img_path): exit(f'invalid path provided, cannot find anything at {img_path') |
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 PIL import Image | |
import os | |
import math | |
import multiprocessing | |
import threading | |
cpu_strength = int(math.ceil(multiprocessing.cpu_count() / 2)) | |
if cpu_strength == 0: cpu_strength = 1 | |
img_path = str(input( |