Snippets Collections
/**
 * 
 * 
 * PRIORITIES : 
 * who comes first ? 
 * 6 + 1  
 * Promo >= 49
 * 
 *  
 */

// // Function to check if user has allowed role
function belair_user_has_allowed_role() {
    $allowed_roles = array( 'pro' );
    $user = wp_get_current_user();

    if ( array_intersect( $allowed_roles, $user->roles ) ) {
        return true;
    }

    return false;
}

function belair_calculate_cart_total_excluding_tax() {
    $cart_total = 0;

    // Get cart contents
    foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
        $product = $cart_item['data'];
        $price_excluding_tax = wc_get_price_excluding_tax( $product );

        // Calculate total excluding tax
        $cart_total += $price_excluding_tax * $cart_item['quantity'];
    }

    return $cart_total;
}
 

function belair_check_for_wholesale_prices_in_cart() {
	$cart = WC()->cart->get_cart();
	$found = false;

	foreach ( $cart as $cart_item_key => $cart_item ) {
		
// 		echo "<pre>";
// 		print_r($cart_item['wwp_data']);
// 		echo "</pre>";
		
		if ( isset( $cart_item['wwp_data'] ) && is_array( $cart_item['wwp_data'] ) ) {
			if ( $cart_item['wwp_data']['wholesale_priced'] === 'yes' ) {
				// The cart item contains the specified array
				$found = true;
				break; // Stop the loop since we found a matching item
			}
		}
	}
	
	return $found;
}


// Hook to apply or remove promo code based on total and user role
function belair_apply_or_remove_promo_code_based_on_total_and_user_role() { 
	// Check if user has allowed role
	if ( belair_user_has_allowed_role() ) {
		
		$cart_total = belair_calculate_cart_total_excluding_tax();
		$promo_code = '49ht30'; // use lowercase letters
		$coupon_applied = in_array(  $promo_code, WC()->cart->get_applied_coupons() );
		$tarifs_revendeurs_applied =  belair_check_for_wholesale_prices_in_cart();
		
// 		error_log(print_r([
// 			'cart_total' => $cart_total,
// 			'coupon_applied' => $coupon_applied,
// 			'tarifs_revendeurs_applied' => $tarifs_revendeurs_applied,
// 		]));
		
		// Prevent recursive recalculations
		remove_action('woocommerce_before_calculate_totals', 'belair_apply_or_remove_promo_code_based_on_total_and_user_role', 999);

	 
		// Adjust promo code based on cart total
		if ( $cart_total >= 49 && !$tarifs_revendeurs_applied )  {
			
// 			error_log("We are in coupon territory");
			
			if(!$coupon_applied){
				
			// Apply promo code
			WC()->cart->apply_coupon( $promo_code );
				$message = "Vous avez atteint 49€ HT de commande, votre réduction de 30% a été appliquée.";
				wc_add_notice($message, 'success');
			}
			
		} elseif ( $cart_total < 49 && $coupon_applied ) {
			// Remove promo code
			WC()->cart->remove_coupon( $promo_code );
			
// 			wc_add_notice("Below coupon territory", 'success');
			
			$message = "Votre panier n'atteint pas les 49€ HT pour bénéficier de -30%; veuillez ajouter des produits à votre commande.";
			wc_add_notice($message, 'success');
		} elseif ( $tarifs_revendeurs_applied ){
			
			 
// 			wc_add_notice("Above coupon territory", 'success');
			
			// Remove coupon as now Wholesaleprices apply and we don't want both at once
			WC()->cart->remove_coupon( $promo_code );
		
		}
		
		
	}

    // Reattach hook
    add_action('woocommerce_before_calculate_totals', 'belair_apply_or_remove_promo_code_based_on_total_and_user_role', 999);

}

// Hook into WooCommerce actions
add_action( 'woocommerce_before_calculate_totals', 'belair_apply_or_remove_promo_code_based_on_total_and_user_role', 999 );

// add_action( 'woocommerce_before_calculate_totals', 'belair_apply_or_remove_promo_code_based_on_total_and_user_role', 999 );




add_filter( 'woocommerce_package_rates', 'conditionally_show_shipping_method_based_on_coupon', 10, 2 );
function conditionally_show_shipping_method_based_on_coupon( $rates, $package ) {
    $required_coupon = '49ht30'; // Change this to your coupon code
    $targeted_shipping_method_id = 'service_point_shipping_method:52'; // Adjust this to match the method you want to restrict

    // Check if the required coupon is applied
    if ( ! in_array( strtolower( $required_coupon ), WC()->cart->get_applied_coupons() ) ) {
        foreach ( $rates as $rate_id => $rate ) {
            if ( $rate_id === $targeted_shipping_method_id ) {
                unset( $rates[ $rate_id ] );
            }
        }
    }

    return $rates;
}
Week-6
import pandas as pd from sklearn.preprocessing import LabelEncoder from sklearn.tree import DecisionTreeClassifier, plot_tree import matplotlib.pyplot as plt pandas: Used for handling and manipulating the dataset in DataFrame format. LabelEncoder: A class from sklearn.preprocessing used to convert categorical values (like "Sunny", "Rainy", etc.) into numeric values because machine learning algorithms require numeric input. DecisionTreeClassifier: A class from sklearn.tree that implements the Decision Tree algorithm for classification. plot_tree: A function from sklearn.tree used to visualize the trained decision tree. matplotlib.pyplot: Used for plotting and visualizing the tree.
import pandas as pd
from sklearn.preprocessing import LabelEncoder
from sklearn.tree import DecisionTreeClassifier, plot_tree
import matplotlib.pyplot as plt

# Sample "Play Tennis" dataset
data = {
    'Outlook': ['Sunny', 'Sunny', 'Overcast', 'Rainy', 'Rainy', 'Rainy',
                'Overcast', 'Sunny', 'Sunny', 'Rainy', 'Sunny', 'Overcast',
                'Overcast', 'Rainy'],
    'Temperature': ['Hot', 'Hot', 'Hot', 'Mild', 'Cool', 'Cool',
                    'Cool', 'Mild', 'Cool', 'Mild', 'Mild', 'Mild',
                    'Hot', 'Mild'],
    'Humidity': ['High', 'High', 'High', 'High', 'Normal', 'Normal',
                 'Normal', 'High', 'Normal', 'Normal', 'Normal', 'High',
                 'Normal', 'High'],
    'Wind': ['Weak', 'Strong', 'Weak', 'Weak', 'Weak', 'Strong',
             'Strong', 'Weak', 'Weak', 'Weak', 'Strong', 'Strong',
             'Weak', 'Strong'],
    'Play': ['No', 'No', 'Yes', 'Yes', 'Yes', 'No',
             'Yes', 'No', 'Yes', 'Yes', 'Yes', 'Yes',
             'Yes', 'No']
}

# Load data into DataFrame
df = pd.DataFrame(data)

# Encode categorical variables using  Label Encoder
label_encoders = {}
for column in df.columns:
    le = LabelEncoder()
    df[column] = le.fit_transform(df[column])
    label_encoders[column] = le

# Separate features and target
X = df.drop('Play', axis=1)
y = df['Play']

# Train Decision Tree model
dt = DecisionTreeClassifier(max_depth=3, random_state=1)
dt.fit(X, y)

# Plot the Decision Tree
plt.figure(figsize=(12, 6))
plot_tree(
    dt,
    feature_names=X.columns,
    class_names=label_encoders['Play'].classes_,  # ['No', 'Yes']
    filled=True,
    rounded=True
)
plt.title("Decision Tree - Play Tennis")
plt.tight_layout()
plt.show()
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error, r2_score

# Sample dataset: you can replace this with your own dataset
# For this example, we're assuming a dataset with 3 features
data = {
    'Feature1': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
    'Feature2': [1, 2, 1, 3, 5, 6, 4, 8, 9, 10],
    'Feature3': [5, 7, 6, 8, 6, 7, 8, 9, 10, 11],
    'Target': [5, 7, 6, 9, 11, 13, 14, 17, 19, 21]
}

# Convert to DataFrame
df = pd.DataFrame(data)

# Features (X) and Target variable (y)
X = df[['Feature1', 'Feature2', 'Feature3']]
y = df['Target']

# Split the data into training and testing sets
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

# Create the model
model = LinearRegression()

# Train the model
model.fit(X_train, y_train)

# Make predictions
y_pred = model.predict(X_test)

# Evaluate the model
mse = mean_squared_error(y_test, y_pred)
r2 = r2_score(y_test, y_pred)

print(f"Mean Squared Error: {mse}")
print(f"R-squared: {r2}")

# Output the coefficients and intercept
print(f"Coefficients: {model.coef_}")
print(f"Intercept: {model.intercept_}")

# Visualizing the results (optional, for 3D)
from mpl_toolkits.mplot3d import Axes3D

# Just a 3D plot for 3 features
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')

# Scatter plot for actual data
ax.scatter(X_test['Feature1'], X_test['Feature2'], y_test, color='blue', label='Actual data')

# Scatter plot for predicted data
ax.scatter(X_test['Feature1'], X_test['Feature2'], y_pred, color='red', label='Predicted data')

ax.set_xlabel('Feature1')
ax.set_ylabel('Feature2')
ax.set_zlabel('Target')
plt.legend()
plt.show()
week-8:
# Import necessary libraries
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score, classification_report

# Load a sample dataset (Iris)
data = load_iris()
X = data.data        # Features
y = data.target      # Labels

# For binary classification, select only two classes (e.g., class 0 and 1)
X = X[y != 2]
y = y[y != 2]

# Split into training and testing data
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

# Initialize the Logistic Regression model
model = LogisticRegression()

# Train the model
model.fit(X_train, y_train)

# Predict on the test data
y_pred = model.predict(X_test)

# Evaluate the model
print("Accuracy:", accuracy_score(y_test, y_pred))
print("Classification Report:\n", classification_report(y_test, y_pred))	

output:
Accuracy: 1.0
Classification Report:
            precision    recall  f1-score   support   
0       1.00      1.00      1.00        12
           1       1.00      1.00      1.00         8

    accuracy                           1.00        20
   macro avg       1.00      1.00      1.00        20
weighted avg       1.00      1.00      1.00        20
Week -7 
Implementation of KNN USING SKlinear:
The K-Nearest Neighbors (KNN) algorithm is a simple, versatile machine learning method used for both classification and regression tasks. It makes predictions by finding the "k" closest data points (neighbors) to a new data point in a feature space and using their labels or values to make a prediction for the new point. 
# Import necessary libraries
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
from sklearn.metrics import accuracy_score, classification_report

# Load a sample dataset (Iris)
data = load_iris()
X = data.data        # Features
y = data.target      # Labels

# Split into train and test sets (80% train, 20% test)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

# Initialize the KNN classifier with k=3
knn = KNeighborsClassifier(n_neighbors=3)

# Train the model
knn.fit(X_train, y_train)

# Predict on test data
y_pred = knn.predict(X_test)

# Evaluate the model
print("Accuracy:", accuracy_score(y_test, y_pred))
print("Classification Report:\n", classification_report(y_test, y_pred))

output:

Accuracy: 1.0
Classification Report:
               precision    recall  f1-score   support

           0       1.00      1.00      1.00        10
           1       1.00      1.00      1.00         9
           2       1.00      1.00      1.00        11

    accuracy                           1.00        30
   macro avg       1.00      1.00      1.00        30
weighted avg       1.00      1.00      1.00        30
function validNumber(...anyAmountOfArgs) {
    return anyAmountOfArgs.every((val) => Number.isFinite(val) && val > 0);
}

// Validate distance and duration always
// using 2 params
if (!validNumber(distance, duration)) {
  alert("Please enter positive numbers for distance and duration.");
  return;
}

// Validate cadence if running
// using 1 param
if (type === "running" && !validNumber(cadence)) {
  alert("Please enter a positive number for cadence.");
  return;
}
/* html*/ 
 <div class="form__row">
            <label class="form__label">Cadence</label>
            <input
              class="form__input form__input--cadence"
              placeholder="step/min"
            />
          </div>
          <div class="form__row form__row--hidden">
            <label class="form__label">Elev Gain</label>
            <input
              class="form__input form__input--elevation"
              placeholder="meters"
            />
          </div>




/* Map JS*/
inputType.addEventListener("change", (e) => updateSelect(e));

function updateSelect(e) {
    const { target } = e;

    const value = target.value;

    const cadenceRow = inputCadence.closest(".form__row");
    const elevationRow = inputElevation.closest(".form__row");

    // Remove the hidden class from both rows first
    cadenceRow.classList.remove("form__row--hidden");
    elevationRow.classList.remove("form__row--hidden");

    const selected = {
      cycling: elevationRow,
      running: cadenceRow,
    };

    selected[value].classList.add("form__row--hidden");
  }



/* with a reusable function */


const inputType = document.querySelector('.form__input--type');

inputType.addEventListener("change", function (e) {
  const value = e.target.value;

  // run the toggleFieldVisibility here
  toggleFieldVisibility(value, {
    running: '.form__input--elevation',
    cycling: '.form__input--cadence',
  });
});

function toggleFieldVisibility(selectedType, hiddenFieldMap) {
  // First remove hidden class from all mapped fields
  Object.values(hiddenFieldMap).forEach(selector => {
    const row = document.querySelector(selector)?.closest('.form__row');
    row?.classList.remove('form__row--hidden');
  });

  // Then hide the one mapped to the selected type
  const selectorToHide = hiddenFieldMap[selectedType];
  const rowToHide = document.querySelector(selectorToHide)?.closest('.form__row');
  rowToHide?.classList.add('form__row--hidden');
}
def fibonacci_series(n):
    fib_sequence = [0, 1]  # Starting values for Fibonacci series

    while len(fib_sequence) < n:
        # Add the last two numbers to get the next one
        next_number = fib_sequence[-1] + fib_sequence[-2]
        fib_sequence.append(next_number)

    return fib_sequence[:n]  # Return only first 'n' elements

# Example usage
num_terms = int(input("Enter the number of terms: "))
print("Fibonacci Series:")
print(fibonacci_series(num_terms))
firstelem = List();
eachlist = List();
//
visual = Visual_Inspection[Door_ID_online = input.Door_ID_online].ID.getAll();
sizz = visual.size();
currentpos = (sizz - 1) % 4 + 1;
//
mapp = Map();
mapp = {1:0,2:1,3:2,4:3};
//fetch correct 1st visual inspection in current batch
fet = mapp.get(currentpos.toLong());
//
for each  viz in Visual_Inspection[Door_ID_online == input.Door_ID_online && archived = false] sort by Date_of_inspection desc
{
	eachlist.add(viz.ID);
}
if(eachlist.size() > 0)
{
	firstelem.add(eachlist.get(fet));
}
 -- DROP TABLE team_kingkong.onus_Fastag_TrustedUser_CCDC_Weekly_Monthly_limitCheck_breaches;

-- CREATE TABLE team_kingkong.onus_Fastag_TrustedUser_CCDC_Weekly_Monthly_limitCheck_breaches AS
INSERT INTO team_kingkong.onus_Fastag_TrustedUser_CCDC_Weekly_Monthly_limitCheck_breaches
with onus_txn_base as
    (SELECT DISTINCT A.*, case when m1.mid is not null then category else 'Others' end as business_category FROM 
        (select userid, transactionid,
        cast(eventAmount as double) / 100 as amt,
        dateinserted,
        substr(cast(dateinserted as varchar(30)), 1, 7) as mnth,
        paymethod, paytmmerchantid, responsestatus, actionrecommended, velocitytimestamp
        FROM cdp_risk_transform.maquette_flattened_onus_snapshot_v3
        WHERE DATE(dl_last_updated) BETWEEN DATE(DATE'2025-04-01' - INTERVAL '30' DAY) AND DATE'2025-04-30'
        AND SOURCE = 'PG'
        AND responsestatus IN ('SUCCESS') AND actionrecommended = 'PASS'
        AND paytmmerchantid IN ('PTMFVT32998068120662') AND paymethod IN ('DEBIT_CARD', 'CREDIT_CARD')
        AND eventid IN (SELECT eventlinkid
        FROM risk_maquette_data_async.pplus_payment_result_prod_async_snapshot_v3
        WHERE dl_last_updated BETWEEN DATE(DATE'2025-04-01' - INTERVAL '30' DAY) AND DATE'2025-04-30')) a
    left join
        (select * from team_kingkong.voc_mid_categorization where mid != '') m1
    on a.paytmmerchantid = m1.mid)
 
SELECT * FROM 
    (SELECT A.*
    -- No.of attempted txns last 7 days > 20 (consider only the CCBP transactions)
    , SUM(IF(DATE(B.dateinserted) BETWEEN DATE(DATE(A.dateinserted) - INTERVAL '7' DAY) AND DATE(A.dateinserted), B.amt, NULL)) AS week_amt
    , 25295 AS week_threshold
    -- No.of attempted txns per calendar month > 30 (consider only the CCBP transactions)
    , SUM(IF(DATE(B.dateinserted) BETWEEN date_trunc('month', DATE(A.dateinserted)) AND DATE(A.dateinserted), B.amt, NULL)) AS month_amt
    , 50590 AS month_threshold
    FROM
        (SELECT * FROM onus_txn_base
        WHERE DATE(dateinserted) BETWEEN DATE'2025-04-01' AND DATE'2025-04-30'
        )A
    INNER JOIN
        (SELECT * FROM onus_txn_base)B
    ON A.userid = B.userid AND A.transactionid <> B.transactionid AND B.velocitytimestamp < A.velocitytimestamp
    AND DATE(B.dateinserted) BETWEEN DATE(A.dateinserted - INTERVAL '30' DAY) AND DATE(A.dateinserted)
    GROUP BY 1,2,3,4,5,6,7,8,9,10,11)
WHERE ((amt + week_amt) >= week_threshold) OR ((amt + month_amt) >= month_threshold)
;
{
	"blocks": [
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":x-connect: Xero Boost Days! :x-connect:"
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "Good morning Brisbane! Please see below for what's on this week."
			}
		},
		{
			"type": "divider"
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":calendar-date-4: Monday, 2nd June",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "\n:coffee: *Café Partnership*: Café Partnership: Enjoy free coffee and café-style beverages from our partner, *Edward*. \n\n :lunch: *Lunch*: from *12pm* in the kitchen."
			}
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":calendar-date-5: Wednesday, 4th June",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": ":coffee: *Café Partnership*: Café Partnership: Enjoy coffee and café-style beverages from our partner, *Edward*. \n\n :late-cake: *Morning Tea*: from *10am* in the kitchen."
			}
		},
		{
			"type": "divider"
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "*LATER THIS MONTH:*"
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "*13th June* *&* *27th June*\n :blob-party: *Social Happy Hour*: Wind down over some drinks & nibbles with your work pals!"
			}
		},
		{
			"type": "divider"
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "Stay tuned to this channel for more details, check out the <https://calendar.google.com/calendar/u/0?cid=Y19uY2M4cDN1NDRsdTdhczE0MDhvYjZhNnRjb0Bncm91cC5jYWxlbmRhci5nb29nbGUuY29t|*Brisbane Social Calendar*>, and get ready to Boost your workdays!\n\nLove,\nWX Team :party-wx:"
			}
		}
	]
}
{
	"blocks": [
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":x-connect: Xero Boost Days! :x-connect:"
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "Good morning Sydney! Please see below for what's on this week."
			}
		},
		{
			"type": "divider"
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":calendar-date-4: Wednesday, 4th June",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "\n:coffee: *Café Partnership*: Café Partnership: Enjoy free coffee and café-style beverages from our partner, *Naked Duck* \n\n :breakfast: *Breakfast*: from *9am* in the All Hands Space."
			}
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":calendar-date-5: Thursday, 5th June",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": ":coffee: *Café Partnership*: Café Partnership: Enjoy coffee and café-style beverages from our partner, *Naked Duck*\n\n :late-cake: *Lunch*: from *12:30pm* in the All Hands Space."
			}
		},
		{
			"type": "divider"
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "*LATER THIS MONTH:*"
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "*Thursday, 12th June *\n :blob-party: *Social Happy Hour*: Wind down over some drinks & nibbles with your work pals!"
			}
		},
		{
			"type": "divider"
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "Stay tuned to this channel for more details, check out the <https://calendar.google.com/calendar/u/0/r?cid=Y185aW90ZWV0cXBiMGZwMnJ0YmtrOXM2cGFiZ0Bncm91cC5jYWxlbmRhci5nb29nbGUuY29t|*Sydney Social Calendar*>, and get ready to Boost your workdays!\n\nLove,\nWX Team :party-wx:"
			}
		}
	]
}
select mid,month(dateinserted) as Month,
sum(txn_amount) failedGMV
from (
select
transactionid,
max(dateinserted) dateinserted ,
max(cast(eventamount as double)/100) txn_amount            ,
max(paytmmerchantid) mid 
from
cdp_risk_transform.maquette_flattened_offus_snapshot_v3
where 
dl_last_updated >= date'2024-10-01'
and DATE (dateinserted)  between date '2024-10-01' and date '2025-01-31'
AND actionrecommended = 'BLOCK'
group by 1)
group by 1,2
 
select pg.mid,
pg.Month,
CASE
  WHEN m_3.o_mid IS NOT NULL THEN 'Online'
  WHEN m_4.e_mid IS NOT NULL THEN 'EDC'
  ELSE 'QR'
 END AS EDC_QR,
  m_7.channel as subBusiness,
 mcc.mcc as mccCode,
 pg.category,
 pg.subCategory,
 sum(pg.attemptedGMV)as attemptedGMV,
 sum(pg.seccessfulGMV) asseccessfulGMV ,
 sum(pg.refundGMV) refundGMV,
sum(rej.rejectedGMV)rejectedGMV ,
sum(pg.failedGMV) failedGMV,
sum(frd.fraudGMV) fraudGMV,
sum(cb.cbGMV) cbGMV
 from
(SELECT mid, month(txn_started_at) as Month,category,sub_category subCategory,
       sum(txn_amount) as attemptedGMV, sum(Case when txn_status = 'SUCCESS'  then txn_amount else 0 end) as seccessfulGMV,
       sum(Case when txn_status <> 'SUCCESS'  then txn_amount else 0 end) as failedGMV,
       sum(case when txn_status = 'SUCCESS' and refund_amount is not null and refund_amount > 0 then txn_amount end) as refundGMV
                FROM
                dwh.pg_olap
                WHERE category NOT IN ('OnPaytm', 'Test')
                AND mid IS NOT NULL
                AND txn_amount > 0
                AND txn_id IS NOT NULL
                AND ingest_date >=  date '2024-10-01'
                AND DATE (substr(cast(txn_started_at AS VARCHAR), 1, 10))  between date '2024-10-01' and date '2025-02-28'
group by 1,2,3,4) as pg

-- Mapping QR/EDC mids
LEFT JOIN (
  SELECT DISTINCT merchant_id AS o_mid
  FROM datalake.online_payment_merchants
 ) AS m_3 
 ON pg.mid = m_3.o_mid
 LEFT JOIN (
  SELECT DISTINCT
   mid AS e_mid
  FROM
   paytmpgdb.entity_edc_info_snapshot_v3
  WHERE
   terminal_status = 'ACTIVE'
   AND dl_last_updated >= DATE '2010-01-01'
 ) m_4 ON pg.mid = m_4.e_mid

 -- Mapping Channel here
  LEFT Join (
  select distinct
   pg_mid,
   channel
  from
   cdo.total_offline_merchant_base_snapshot_v3
 ) AS m_7 ON pg.mid = m_7.pg_mid
 left join
 (SELECT  distinct upi_mcc_code mcc,
          category ,
          sub_category  
          FROM paytmpgdb.mcc_code_mapping_snapshot_v3) mcc 
          on pg.category = mcc.category and pg.subCategory = mcc.sub_category

-- Mapping rejected GMV
left join 
(select mid,month(dateinserted) as Month,
sum(txn_amount) rejectedGMV
from (
select
transactionid,
max(dateinserted) dateinserted ,
max(cast(eventamount as double)/100) txn_amount            ,
max(paytmmerchantid) mid 
from
cdp_risk_transform.maquette_flattened_offus_snapshot_v3
where 
dl_last_updated >= date'2024-10-01'
and DATE (dateinserted)  between date '2024-10-01' and date '2025-02-28'
AND actionrecommended = 'BLOCK'
group by 1)
group by 1,2) as rej ON pg.mid = rej.mid and pg.Month=rej.Month

-- Mapping fraudGMV
left join
(select mid,month(txn_date) as Month,
sum(txn_amount) fraudGMV
from
        (select
          old_pg_txn_id as txn_id,
          min(cast(old_pg_txn_amount as double)) txn_amount,
          min(date(old_pg_txn_started_at)) txn_date,
          min(old_pg_ingest_date) old_pg_ingest_date,
          min(old_pg_mid) mid
        from
          frauds.fraud_combined_snapshot_v3
        where
        dl_last_updated >= date'2024-10-01'
        and DATE (old_pg_txn_started_at)  between date '2024-10-01' and date '2025-02-28'
          and table_name in (
            'ppsl_cybercell',
            'ro_panel_cybmerchant_details_with_pg_olap',
            'lending_fraud',
            'efrm',
            'ppsl_bank_escalations',
            'ro_panel_minifmr_l2_PPI',
            'ro_panel_minifmr_l2_BNK'
          )
          and old_pg_category NOT IN ('OnPaytm', 'Test')
          and old_pg_txn_status = 'SUCCESS'
          AND old_pg_mid IS NOT NULL
          AND cast(old_pg_txn_amount as double) > 0
          AND old_pg_txn_id IS NOT NULL
        group by 1)
        group by 1,2) as frd on pg.mid=frd.mid and pg.Month=frd.Month
-- Mapping chargeBack
left join (select mid,
       month(date(substr(CAST (old_pg_txn_started_at AS varchar), 1, 10))) Month ,
       count(transaction_id) cbCount,
       sum(cbGMV) cbGMV
from (
select 
transaction_id, 
max(old_pg_mid) mid,
sum(chargeback_amount) cbGMV,
max(old_pg_txn_started_at) old_pg_txn_started_at
from
 cdp_risk_transform.transaction_level_chargeback_snapshot_v3
WHERE old_pg_ingest_date >= date'2024-10-01'
  AND date(substr(CAST (old_pg_txn_started_at AS varchar), 1, 10)) 
  between date'2024-10-01' and date '2025-02-28'
group by 1)
group by 1,2) as cb on pg.mid=cb.mid and pg.Month=cb.Month
where pg.mid = 'NEHAEL54380289516455'
group  by 1,2,3,4,5,6,7;
-- MONTHLY BREACHES & CASHBACK & FRAUD %GE
SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month
, COUNT(transactionid) AS breach_cnt
, SUM(txn_amount) as breach_amt
, COUNT(DISTINCT small_vpa) as breach_card_cnt
, SUM(CAST(cashback_amount AS DOUBLE)) AS cashback_amount
, SUM(CAST(fraud_amount AS DOUBLE)) AS fraud_amount
FROM
    (SELECT DISTINCT A.txn_date, A.transactionid, A.txn_amount, A.small_vpa
    , B.amount AS cashback_amount
    , C.fraud_amount as fraud_amount
    FROM
        (SELECT * FROM team_kingkong.offus_CCUPI_vpa_mid_daily_limit_breaches)A 
    LEFT JOIN
        (select * from
            (select a.*, ROW_NUMBER() OVER (PARTITION BY txn_id ORDER BY cb_level desc) as row_num from
                (select distinct txn_id, amount, cb_level
                from charge_team_data.cb_data_analytics_snapshot_v3
                where dl_last_updated >= date '2000-01-01')a)a
        where row_num = 1)B
    on B.txn_id = A.transactionid
    LEFT JOIN
        (select * from
            (select distinct pg_txn_id as txn_id, txn_amount as fraud_amount,
            substr(txn_date,1,10) as txn_date, mid,
            min(source_reporting_date) as reporting_date
            from cdp_risk_transform.fraud_master_snapshot_v3
            where source_table <> 'freshdesk.cst_case_snapshot'
            and txn_status = 'SUCCESS'
            and dl_last_updated >= date '2025-01-01'
            group by 1,2,3,4) i
        left join
            (SELECT distinct acq_id, CAST(refund_amount AS DOUBLE) / 100 AS fraud_refund
            FROM pgaws_datalake_prod.acq_refund_snapshot_v3
            WHERE dl_last_updated >= date'2025-01-01' AND refund_status = 'SUCCESS') j
        ON i.txn_id = j.acq_id)C
    ON A.transactionid = C.txn_id)
GROUP BY 1 ORDER BY 1;
-- CREATE TABLE team_kingkong.onus_CCBP_sucTxn_user_1d_7d_30d_breaches AS 
INSERT INTO team_kingkong.onus_CCBP_sucTxn_user_1d_7d_30d_breaches
with onus_txn_base as
    (SELECT DISTINCT A.*, case when m1.mid is not null then category else 'Others' end as business_category FROM 
        (select userid, transactionid,
        cast(eventAmount as double) / 100 as amt,
        dateinserted,
        substr(cast(dateinserted as varchar(30)), 1, 7) as mnth,
        paymethod, paytmmerchantid, velocitytimestamp
        FROM cdp_risk_transform.maquette_flattened_onus_snapshot_v3
        WHERE DATE(dl_last_updated) BETWEEN DATE(DATE'2025-04-01' - INTERVAL '30' DAY) AND DATE'2025-04-30'
        AND SOURCE = 'PG'
        AND paytmmerchantid IN ('PTMCBP84799392178473','PTMVIS48435535949128','PTMCBP11428987150800')
        AND eventid IN (SELECT eventlinkid
        FROM risk_maquette_data_async.pplus_payment_result_prod_async_snapshot_v3
        WHERE dl_last_updated BETWEEN DATE(DATE'2025-04-01' - INTERVAL '30' DAY) AND DATE'2025-04-30')
        AND responsestatus IN ('SUCCESS') AND actionrecommended = 'PASS') a
    left join
        (select * from team_kingkong.voc_mid_categorization where mid != '') m1
    on a.paytmmerchantid = m1.mid)

SELECT * FROM 
    (SELECT A.*
    -- No.of successful txns per user per calendar day > 8 (consider only the CCBP transactions)
    , COUNT(IF(DATE(B.dateinserted) = DATE(A.dateinserted), B.transactionid, NULL)) AS txn_attempted_same_day
    , 8 AS txn_attempted_same_day_threshold
    -- No.of successful txns last 7 days > 15 (consider only the CCBP transactions)
    , COUNT(IF(DATE(B.dateinserted) BETWEEN DATE(DATE(A.dateinserted) - INTERVAL '7' DAY) AND DATE(A.dateinserted), B.transactionid, NULL)) AS txn_attempted_7_day
    , 15 AS txn_attempted_7_day_threshold
    -- No.of successful txns per calendar month > 25 (consider only the CCBP transactions)
    , COUNT(IF(DATE(B.dateinserted) BETWEEN date_trunc('month', DATE(A.dateinserted)) AND DATE(A.dateinserted), B.transactionid, NULL)) AS txn_attempted_cal_month
    , 25 AS txn_attempted_cal_month_threshold
    FROM
        (SELECT * FROM onus_txn_base
        WHERE DATE(dateinserted) BETWEEN DATE'2025-04-01' AND DATE'2025-04-30')A
    INNER JOIN
        (SELECT * FROM onus_txn_base)B
    ON A.userid = B.userid AND A.transactionid <> B.transactionid AND B.velocitytimestamp < A.velocitytimestamp
    AND DATE(B.dateinserted) BETWEEN DATE(A.dateinserted - INTERVAL '30' DAY) AND DATE(A.dateinserted)
    GROUP BY 1,2,3,4,5,6,7,8,9)
WHERE (txn_attempted_same_day >= txn_attempted_same_day_threshold) OR (txn_attempted_7_day >= txn_attempted_7_day_threshold) OR (txn_attempted_cal_month >= txn_attempted_cal_month_threshold)
;
-- DROP TABLE team_kingkong.onus_CCBP_attempt_Txn_user_1d_7d_30d_breaches;

-- CREATE TABLE team_kingkong.onus_CCBP_attempt_Txn_user_1d_7d_30d_breaches AS
INSERT INTO team_kingkong.onus_CCBP_attempt_Txn_user_1d_7d_30d_breaches
with onus_txn_base as
    (SELECT A.*, case when m1.mid is not null then category else 'Others' end as business_category FROM 
        (
        select distinct userid, transactionid,
        cast(eventAmount as double) / 100 as amt,
        dateinserted,
        substr(cast(dateinserted as varchar(30)), 1, 7) as mnth,
        paymethod, paytmmerchantid, responsestatus, actionrecommended, velocitytimestamp
        FROM cdp_risk_transform.maquette_flattened_onus_snapshot_v3
        WHERE DATE(dl_last_updated) BETWEEN DATE(DATE'2025-04-01' - INTERVAL '30' DAY) AND DATE'2025-04-30'
        AND SOURCE = 'PG'
        AND paytmmerchantid IN ('PTMCBP84799392178473','PTMVIS48435535949128','PTMCBP11428987150800')
        AND eventid IN (SELECT eventlinkid
        FROM risk_maquette_data_async.pplus_payment_result_prod_async_snapshot_v3
        WHERE dl_last_updated BETWEEN DATE(DATE'2025-04-01' - INTERVAL '30' DAY) AND DATE'2025-04-30')
        ) a
    left join
        (select * from team_kingkong.voc_mid_categorization where mid != '') m1
    on a.paytmmerchantid = m1.mid)

SELECT * FROM 
    (SELECT A.*
    -- No.of attempted txns per user per calendar day  > 12 (consider only the CCBP transactions)
    , COUNT(IF(DATE(B.dateinserted) = DATE(A.dateinserted), B.transactionid, NULL)) AS txn_attempted_same_day
    , 12 AS txn_attempted_same_day_threshold
    -- No.of attempted txns last 7 days > 20 (consider only the CCBP transactions)
    , COUNT(IF(DATE(B.dateinserted) BETWEEN DATE(DATE(A.dateinserted) - INTERVAL '7' DAY) AND DATE(A.dateinserted), B.transactionid, NULL)) AS txn_attempted_7_day
    , 20 AS txn_attempted_7_day_threshold
    -- No.of attempted txns per calendar month > 30 (consider only the CCBP transactions)
    , COUNT(IF(DATE(B.dateinserted) BETWEEN date_trunc('month', DATE(A.dateinserted)) AND DATE(A.dateinserted), B.transactionid, NULL)) AS txn_attempted_cal_month
    , 30 AS txn_attempted_cal_month_threshold
    FROM
        (SELECT * FROM onus_txn_base
        WHERE DATE(dateinserted) BETWEEN DATE'2025-04-01' AND DATE'2025-04-30'
        AND responsestatus IN ('SUCCESS') AND actionrecommended = 'PASS')A
    INNER JOIN
        (SELECT * FROM onus_txn_base)B
    ON A.userid = B.userid AND A.transactionid <> B.transactionid AND B.velocitytimestamp < A.velocitytimestamp
    AND DATE(B.dateinserted) BETWEEN DATE(A.dateinserted - INTERVAL '30' DAY) AND DATE(A.dateinserted)
    GROUP BY 1,2,3,4,5,6,7,8,9,10,11)
WHERE (txn_attempted_same_day >= txn_attempted_same_day_threshold) OR (txn_attempted_7_day >= txn_attempted_7_day_threshold) OR (txn_attempted_cal_month >= txn_attempted_cal_month_threshold)
;
DROP TABLE team_kingkong.onus_on_us_sbi_nb_limit_breaches;

-- CREATE TABLE team_kingkong.onus_on_us_sbi_nb_limit_breaches AS 
INSERT INTO team_kingkong.onus_on_us_sbi_nb_limit_breaches 
SELECT A.*, case when m1.mid is not null then category else 'Others' end as business_category
, 100000 as per_txn_threshold
FROM 
    (select distinct userid, transactionid,
    cast(eventAmount as double) / 100 as amt,
    dateinserted,
    substr(cast(dateinserted as varchar(30)), 1, 7) as mnth,
    paymethod, paytmmerchantid, responsestatus, actionrecommended
    FROM cdp_risk_transform.maquette_flattened_onus_snapshot_v3
    WHERE DATE(dl_last_updated) BETWEEN DATE(DATE'2025-03-01' - INTERVAL '30' DAY) AND DATE'2025-03-31'
    AND SOURCE = 'PG' AND actionrecommended <> 'BLOCK' AND responsestatus = 'SUCCESS'
    AND paymethod = 'NET_BANKING' AND apicodeoption = 'SBINC1IN_NET_BANKING_PAYMENT'
    AND paytmmerchantid IN ('PTMVIS48435535949128','PTMCBP11428987150800','PTMCBP84799392178473')
    AND (cast(eventAmount as double) / 100) > 100000
    AND eventid IN (SELECT eventlinkid
    FROM risk_maquette_data_async.pplus_payment_result_prod_async_snapshot_v3
    WHERE dl_last_updated BETWEEN DATE(DATE'2025-03-01' - INTERVAL '30' DAY) AND DATE'2025-03-31')) a
left join
    (select * from team_kingkong.voc_mid_categorization where mid != '') m1
on a.paytmmerchantid = m1.mid;
import pandas as pd
import pyarrow as pa
import pyarrow.orc as orc
from glob import glob

dataset = pd.read_csv()

# Read the Pandas dataset as a PyArrow Table
pa_table = pa.Table.from_pandas(dataset)

# Write the PyArrow Table to an ORC file
with pa.OSFile("/home/saravana/Saravana/s3_maintain/s3-maintenance/Download_S3_Files/Datavisiooh/month_03.orc", "wb") as sink:
    with orc.ORCWriter(sink) as writer:
        writer.write(pa_table)

# Read the ORC file back into a Pandas DataFrame
orc_file_path = "/home/saravana/Saravana/s3_maintain/s3-maintenance/Download_S3_Files/Datavisiooh/month_03.orc"
df = orc.read_table(orc_file_path).to_pandas()
# Display the DataFrame
print(df.head())
/*========================================================
  Rise 360 compulsory CSS
  For use in all Digital Learning and Development Rise 360 courses.
  Version 1.0
  Last updated 04/11/2024
==========================================================*/

/*Global variables – edit these variables to suit your course design.
==========================================================*/

:root {
  --custom-theme-colour-button-hover-opacity: .9; /*This sets the opacity of buttons and checkboxes that use the theme colour, such as continue buttons.Lower value equals ligher hover colour.*/
  --custom-carousel-prev-next-hover-colour: #000; /*This sets the hover state colour of the previous and next buttons on the quote carousel and image carousel blocks.*/
}

/*Global CSS edits
==========================================================*/

/*Links > Hover state: Add a background colour and border.*/
.brand--linkColor a:hover {
  outline: solid 3px rgba(0, 0, 0, .1); /*Using transparancy prevents surrounding text, such as full stops, from vanishing.*/
  background-color: rgba(0, 0, 0, .1) !important;
}

/*Cover page
==========================================================*/

/*Cover page > Start module button: Remove all caps, increase font size, decrease font weight, adjust padding.*/
.cover__header-content-action-link-text{
  text-transform: none;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: .1rem;
}
.cover__header-content-action-link {
  padding: 0.8rem 2.9rem !important;
}

/*Cover page > body text: Increase font size and change colour.*/ 
.cover__details-content-description.brand--linkColor {
  color: #000;
  font-size: 1.7rem;
}

/*Cover page > Section titles: Increase font size, remove all caps, darken border line.*/
.overview-list__section-title {
  border-bottom: .1rem solid #717376; /*Colour of the lesson icons.*/
  font-size: 1.4rem;
  text-transform: none;
}

/*Cover page > lesson list: Increase font size.*/
.overview-list-item__title {
  font-size: 1.4rem;
}

/*Navigation menu
==========================================================*/

/*Navigation menu > % progress indicator: Remove all caps, increase font size.*/
.nav-sidebar-header__progress-text {
  text-transform: none !important;
  font-size: 1.4rem !important;
}

/*Navigation menu > Section titles: Remove all caps, increase font size.*/
.nav-sidebar__outline-section-toggle-text {
  text-transform: none;
  font-size: 1.4rem;
}
.nav-sidebar__outline-section-toggle:after {
  border-bottom: 1px solid #717376 !important;
}

/*Navigation menu > Lesson titles: Increase font size.*/
.nav-sidebar__outline-section-item__link {
  font-size: 1.4rem !important;
}

/*Lesson header
==========================================================*/

/*Lesson header > Lesson counter: Increase font size, remove italics.*/
.lesson-header__counter {
  font-size: 1.4rem;
  font-style: normal;
  margin-bottom: 1.3rem !important;
}

/*Text blocks
==========================================================*/

/*Paragraph
----------------------------------------------------------*/

/*Paragraph with heading
----------------------------------------------------------*/

/*Paragraph with subheading
----------------------------------------------------------*/

/*Heading
----------------------------------------------------------*/

/*Subheading
----------------------------------------------------------*/

/*Columns
----------------------------------------------------------*/

/*Table
----------------------------------------------------------*/


/*Statement blocks
==========================================================*/

/*Statement A
----------------------------------------------------------*/

/*Statement B
----------------------------------------------------------*/

/*Statement C
----------------------------------------------------------*/

/*Statement D
----------------------------------------------------------*/

/*Note
----------------------------------------------------------*/


/*Quote blocks
==========================================================*/

/*Quote A
----------------------------------------------------------*/

/*Quote B
----------------------------------------------------------*/

/*Quote C
----------------------------------------------------------*/

/*Quote D
----------------------------------------------------------*/

/*Quote on image
----------------------------------------------------------*/

/*Quote carousel
----------------------------------------------------------*/

/*Quote carousel 
-------------------------------------------------------------*/



/*List blocks
==========================================================*/

/*Numbered list
----------------------------------------------------------*/

/*Checkbox list
----------------------------------------------------------*/

/*Checkbox list > Checkboxes: Move the checkboxes to the front and change the hover colour.*/
.block-list__checkbox {
  z-index: 2;
  transition: all .15s ease-in-out;
}
.block-list__checkbox:hover {
  background-color: var(--color-theme-decorative);
  opacity: var(--custom-theme-colour-button-hover-opacity);
}

/*Bulleted list
----------------------------------------------------------*/


/*Image blocks
==========================================================*/

/*Image blocks > Caption: Increase font size. This can be changed by manually adjusting the font size in Rise.*/
.block-image__caption, .block-gallery__caption {
  font-size: 1.4rem !important;
}

/*Image centered
----------------------------------------------------------*/

/*Image full width
----------------------------------------------------------*/

/*Image & text
----------------------------------------------------------*/

/*Text on image
----------------------------------------------------------*/


/*Gallery blocks
==========================================================*/

/*Carousel
----------------------------------------------------------*/

/* Gallery Carousel 
--------------------------------------------------*/

/*Note that the hover state of the progression circles is modified in the Quote carousel section.*/

/*Two column grid
----------------------------------------------------------*/

/*Three column grid
----------------------------------------------------------*/

/*Four column grid
----------------------------------------------------------*/


/*Multimedia blocks
==========================================================*/

/*Audio
----------------------------------------------------------*/

/*Audio > Play/puase button and scrub slider: Increase size and gap between. Change hover scale.*/
.audio-player__play {
  margin-right: 1.6rem;
}
.audio-player__play .svg-inline--fa {
  height: 1.7rem;
  transition: all 0.15s ease-in-out;
}
.audio-player__play .svg-inline--fa:hover {
  transform: scale(1.2);
}
.audio-player__tracker-handle{
  height: 100%;
}
.audio-player__tracker-handle-icon>svg {
  height: 1.5rem;
  width: 1.5rem;
}
.audio-player__tracker-handle-icon{
  transition: all 0.15s ease-in-out;
}
.audio-player__tracker-handle-icon:hover {
  transform: scale(1.2);
}
.audio-player__tracker-handle-icon:active {
  transform: scale(1.2);
}

/*Audio > track line: Make line thicker.*/
.audio-player__tracker-bar {
  border-top: .16rem solid var(--color-track);
}
.audio-player__tracker:after {
  border-top: .16rem solid var(--color-runner);
}

/*Audio > Timer: Increase font size.*/
.audio-player__timer {
  font-size: 1.2rem;
}

/*Audio > Caption: Increase font size. This can be changed by manually adjusting the font size in Rise.*/
.block-audio__caption {
  font-size: 1.4rem;
}

/*Video
----------------------------------------------------------*/

/*Video > Caption: Change font size to 14px.*/
.block-video__caption {
  font-size: 1.4rem;
}

/*Embed
----------------------------------------------------------*/

/*Attachement
----------------------------------------------------------*/

/*Attachement: Add hover colour.*/
.block-attachment:hover {
  background: #ebebeb;
}

/*Code snippet
----------------------------------------------------------*/

/*Code snippet > Caption: Increase font size.*/
.block-text__code-caption p {
  font-size: 1.4rem;
}

/*Interactive blocks
==========================================================*/

/*Accordion
----------------------------------------------------------*/

/*Tabs
----------------------------------------------------------*/

/*Tabs 
---------------------------------------------------*/


/*Labeled graphic
----------------------------------------------------------*/

/*Labeled graphic
------------------------------------------*/


/*Process
----------------------------------------------------------*/



/*Scenario
----------------------------------------------------------*/


/*Sorting activity
----------------------------------------------------------*/

/*Sorting activity > Restart button: Remove all caps, change font size, colour and letter spacing.*/
.block-sorting-activity .restart-button__content {
  color: var(--color-theme-decorative);
  border-radius: 5px;
  text-transform: none;
  font-size: 1.5rem;
  letter-spacing: .1rem;
  font-weight: 700;
}

/*Sorting activity > Restart button: Add a hover state.*/
.block-sorting-activity .deck__title {
  margin-bottom: 1rem;  
  padding-bottom: .6rem;
  border-bottom: .1rem solid rgba(0, 0, 0, .2);
}
.block-sorting-activity .restart-button {
  margin-top: 0rem;
  border: none;
  padding: 1rem;
  border-radius: 5px;
  min-height: 7.45rem;
}
.block-sorting-activity .restart-button {
  transition: background-color 0.3s;
}
.block-sorting-activity .restart-button:hover {
  background-color: #ebebeb;
}


/*Timeline
----------------------------------------------------------*/

/*Flashcard grid
----------------------------------------------------------*/

/*Flashbard stack
----------------------------------------------------------*/

/*Flashcard stack > Previous and Next button: Change hover state.*/
.block-flashcards-slider__arrow--next, .block-flashcards-slider__arrow--prev {
  transition: opacity .3s;
}
.block-flashcards-slider__arrow--next:hover, .block-flashcards-slider__arrow--prev:hover {
  opacity: var(--custom-theme-colour-button-hover-opacity);
}

/*Flashcard stack > Slide counter: Remove italics.*/
.block-flashcards-slider__progress-text {
  font-style: normal;
}

/*Flashcard stack > Progress line: Increase thickness.*/
.block-flashcards-slider__progress-line {
  border-bottom: max(.2rem, 2px) solid var(--color-progress-track);
  position: relative;
}
.block-flashcards-slider__progress-runner {
  border-bottom: max(.2rem, 2px) solid var(--color-theme-decorative);
}

/*Button
----------------------------------------------------------*/

/*Button and Button stack > Button: Remove all caps, increase font size and line height.*/
.blocks-button__button {
  transition: all .3s;
  text-transform: none;
  font-size: 1.5rem;
  line-height: 3.9rem;
}

/*Button and Button stack > Button: Change hover state.*/
.blocks-button__button:hover {
  opacity: var(--custom-theme-colour-button-hover-opacity);
}

/*Button and Button stack > Button: Offset the focus state outline.*/
.blocks-button__button:focus {
  outline-offset: .4rem;
}

/*Button stack
----------------------------------------------------------*/

/*Storyline
----------------------------------------------------------*/


/*Knowledge check blocks AND Quiz lesson
==========================================================*/

/*Knowledge check/Quiz > Options: remove extra space between question options and submit button/feedback box.*/
.block-knowledge .quiz-card__interactive {
  margin-bottom: 0rem;
}

/*Knowledge check/Quiz > Submit/Next buttons: Remove all caps and increase font size.*/
.quiz-card__button{
  transition: opacity .3s;
  text-transform: none;
  font-size: 1.5rem;
}
  
/*Knowledge check/Quiz > Submit/Next buttons: Change hover state.*/
.quiz-card__button:hover {
  opacity: var(--custom-theme-colour-button-hover-opacity);
}
  
/*Knowledge check/Quiz > Submit/Next buttons: Offset the focus state outline.*/
.quiz-card__button:focus {
  outline-offset: 0.4rem;
}

/*Knowledge check/Quiz > 'Correct/Incorrect' label: Increase font size.*/
.quiz-card__feedback-label {
  font-size: 1.4rem;
}

/*Knowledge check/Quiz > Feedback body text: Increase font size, align left and ensure color is black. */
.quiz-card__feedback-text {
  font-size: 1.6rem;
  text-align: left;
  color: #000;
}

/*Knowledge check > Try again button: Remove all caps, increase font size and change to theme colour. Note that the Rise 360 label text must also be lowercase.*/
.block-knowledge__retake-text {
  text-transform: none;
  font-size: 1.4rem;
}
.block-knowledge__retake {
  color: var(--color-theme-decorative)
}

/*Knowledge check > Try again button: Change hover state.*/
.block-knowledge__retake-content {
  transition: background-color 0.3s;
  border-radius: 5px;
  padding: 1rem;
  margin: -1rem /*Negative margin pushes the margin out into the padding area to create a larger hover state without having to change the padding for the normal state.*/
}
.block-knowledge__retake-content:hover {
  background-color: #ebebeb;
}

/*Multiple choice
----------------------------------------------------------*/

/*Multiple response
----------------------------------------------------------*/

/*Fill in the blank
----------------------------------------------------------*/

/*Fill in the blank > 'Acceptable responses' label: Increase font size and remove italics.*/
.quiz-fill__options {
  font-size: 1.4rem;
  font-style:normal;
}

/*Matching
----------------------------------------------------------*/

/*Matching: Increase font size to 16px.*/
.quiz-match__item-content {
  font-size: 1.5rem;
}

/*Quiz
----------------------------------------------------------*/

/*Quiz > 'Lesson X of Y' label: Increase font size, letter spacing and remove italics.*/
.quiz-header__counter {
  font-size: 1.4rem;
  font-style: normal;
  letter-spacing: .05rem;
}

/*Quiz > 'Start assessment' label: Remove all caps, increase font size, move icon to the left.*/
.quiz-header__start-quiz {
  transition: all .3s;
  text-transform: none;
  font-size: 1.5rem;
  border-radius: 5px;
  padding: 1rem;
  margin: -1rem;
}
.quiz-header__start-quiz [class*=icon-] {
  margin-left: .6rem;
}

/*Quiz > 'Start assessment' label: Add hover state.*/
.quiz-header__start-quiz:hover {
  background-color: #ebebeb;
}

/*Quiz > 'Question' label: Remove italics and increase font size.*/
.quiz-card__step-label {
  font-size: 1.4rem;
  font-style: normal;
  letter-spacing: .05rem;
  font-weight: 400;
}
@media (max-width: 47.9375em) {
  .quiz-card__counter {
    font-size: 2.2rem;
  }
}

/*Quiz > Quiz results odemeter: Increase font size on all elements.*/
.odometer__score-label, .odometer__passlabel, .odometer__passpercent  {
  font-size: 1.4rem;
  text-transform: none;
}

/*Quiz > Quiz results 'Try again' button: Remove all caps, change font colour, size, weight and letter spacing, adjust padding.*/
.quiz-results__footer .restart-button__content {
  transition: background-color 0.3s;
  color: var(--color-theme);
  text-transform: none;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: .1rem;
  padding: 1rem;
  margin: -1rem;
  border-radius: 5px;
}

/*Quiz > Quiz results 'Try again' button: Add hover state.*/
.quiz-results__footer .restart-button__content:hover {
  background-color: #ebebeb;
}


/*Draw from question bank
----------------------------------------------------------*/


/*Chart blocks
==========================================================*/

/*Bar chart
----------------------------------------------------------*/

/*Line chart
----------------------------------------------------------*/

/*Pie chart
----------------------------------------------------------*/


/*Divider blocks
==========================================================*/

/*Continue
----------------------------------------------------------*/
  
/*Continue: Change hover state.*/
.continue-btn {
  transition: opacity 0.3s;
}
.continue-btn:hover {
  opacity: var(--custom-theme-colour-button-hover-opacity);
}

/*Continue: Offset the focus state outline.*/
.continue-btn:focus {
  outline-offset: 0.4rem;
}

/*Divider
----------------------------------------------------------*/

/*Numbered divider
----------------------------------------------------------*/

/*Spacer
----------------------------------------------------------*/


/*CSS edits by Firstname Lastname on XX/XX/202X.*/

/*========================================================
  Optional CSS edits – Paste all optional CSS edits below this comment.
==========================================================*/
## Quick Defaults

```css
font-family: "Helvetica Now Display", "SF Pro Display", "Inter Display", "Inter Tight", Helvetica, Roboto, Arial, -apple-system, sans-serif;
font-family: "SF Pro Display", "Helvetica Now Display", "Inter Display", "Inter Tight", Helvetica, Arial, Roboto, -apple-system, sans-serif;
font-family: "Inter Display", "Inter Tight", "SF Pro Display", "Helvetica Now Display", Helvetica, Roboto, Arial, -apple-system, sans-serif;
font-family: "Inter Tight", "Inter Display", "SF Pro Display", "Helvetica Now Display", Helvetica, Roboto, Arial, -apple-system, sans-serif;
font-family: "Helvetica LT Pro", "Helvetica", "Helvetica Now Text", "SF Pro Text", Roboto, Inter, Arial, -apple-system, sans-serif;
font-family: "Helvetica Now Text", "Helvetica LT Pro", Helvetica, "Helvetica Neue LT Pro", "SF Pro Text", Roboto, Arial, -apple-system, sans-serif;
font-family: "SF Pro Text", "Helvetica Now Text", Roboto, "Helvetica LT Pro", Helvetica, "Helvetica Neue LT Pro", Arial, Roboto, -apple-system, sans-serif;
font-family: Inter, "SF Pro Text", Roboto, "Helvetica Now Text", "Helvetica LT Pro", Helvetica, Arial, -apple-system, sans-serif;
font-family: Roboto, "SF Pro Text", "Helvetica Now Text", "Helvetica LT Pro", Inter, Helvetica, Arial, -apple-system, sans-serif;
font-family: "Helvetica Now Display", "SF Pro Display", "Inter Display", "Inter Tight", Helvetica, Roboto, Arial, -apple-system, sans-serif;
font-family: "Inter Display", "Inter Tight", "SF Pro Display", "Helvetica Now Display", Helvetica, Roboto, Arial, -apple-system, sans-serif;
font-family: "Inter Tight", "Inter Display", "SF Pro Display", "Helvetica Now Display", Helvetica, Roboto, Arial, -apple-system, sans-serif;
```

## Variable Definitions

```css
:root {
--font-disp-helvnow: "Helvetica Now Display", "SF Pro Display", "Inter Display", "Inter Tight", Helvetica, Roboto, Arial, -apple-system, sans-serif;
--font-disp-sfpro: "SF Pro Display", "Helvetica Now Display", "Inter Display", "Inter Tight", Helvetica, Arial, Roboto, -apple-system, sans-serif;
--font-disp-inter: "Inter Display", "Inter Tight", "SF Pro Display", "Helvetica Now Display", Helvetica, Roboto, Arial, -apple-system, sans-serif;
--font-disp-intert: "Inter Tight", "Inter Display", "SF Pro Display", "Helvetica Now Display", Helvetica, Roboto, Arial, -apple-system, sans-serif;
--font-text-helv: "Helvetica LT Pro", "Helvetica", "Helvetica Now Text", "SF Pro Text", Roboto, Inter, Arial, -apple-system, sans-serif;
--font-text-helvnow: "Helvetica Now Text", "Helvetica LT Pro", Helvetica, "Helvetica Neue LT Pro", "SF Pro Text", Roboto, Arial, -apple-system, sans-serif;
--font-text-sfpro: "SF Pro Text", "Helvetica Now Text", Roboto, "Helvetica LT Pro", Helvetica, "Helvetica Neue LT Pro", Arial, Roboto, -apple-system, sans-serif;
--font-text-inter: Inter, "SF Pro Text", Roboto, "Helvetica Now Text", "Helvetica LT Pro", Helvetica, Arial, -apple-system, sans-serif;
--font-text-roboto: Roboto, "SF Pro Text", "Helvetica Now Text", "Helvetica LT Pro", Inter, Helvetica, Arial, -apple-system, sans-serif;
--font-mono-roboto: "Roboto Mono", "Input Mono", "SF Mono", "Cascadia Mono", "Segoe UI Mono", "Cousine", ui-monospace, monospace;
--font-mono-input: "Input Mono", "Roboto Mono", "SF Mono", "Cascadia Mono", "Segoe UI Mono", "Cousine", ui-monospace, monospace;
--font-mono-sfmono: "SF Mono", "Input Mono", "Roboto Mono", "SF Mono", "Cascadia Mono", "Segoe UI Mono", "Cousine", ui-monospace, monospace;
}
```
.post__content a img { 
  display: block; 
}
/* invert elements sort order w/o changing markup: */
.container {
    direction: rtl;
    }
    .container > * { 
        direction: ltr; 
    }

/* or */
ul {
    -webkit-transform: rotate(180deg);
            transform: rotate(180deg);
}
    ul > li {
        -webkit-transform: rotate(-180deg);
                transform: rotate(-180deg);
    }
img {
  image-rendering: auto; /* default */
  image-rendering: crisp-edges; /* fuer Pixel-Art */
  image-rendering: pixelated; /* fuer QR-Codes */
}
.triangle {
	border-color: yellow blue red green;
	border-style: solid;
	border-width: 0px 200px 200px 200px;
	height: 0px;
	width: 0px;
}
/* Resetting the background will solve this issue: */

button {
  appearance: none;
  background: transparent;
  /* Other styles */
}
a[href^="tel"] {
  white-space: nowrap;
  pointer-events: none;
  text-decoration: none;
  color: inherit;
}
@media (max-width: 30em) {
  a[href^="tel"] {
    pointer-events: auto;
    text-decoration: underline;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
.image-contain {
	object-fit: contain;
	object-position: center;
}
.image-cover {
	object-fit: cover;
	object-position: right top;
}
.classname {
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23);
}
star

Mon Jun 02 2025 01:58:37 GMT+0000 (Coordinated Universal Time) https://docs.github.com/en/copilot/managing-copilot/configure-personal-settings/installing-github-copilot-in-the-cli

@Asneedarazali

star

Mon Jun 02 2025 01:58:29 GMT+0000 (Coordinated Universal Time) https://docs.github.com/en/copilot/managing-copilot/configure-personal-settings/installing-github-copilot-in-the-cli

@Asneedarazali

star

Sun Jun 01 2025 14:50:13 GMT+0000 (Coordinated Universal Time)

@nani ##python

star

Sun Jun 01 2025 14:47:35 GMT+0000 (Coordinated Universal Time)

@nani ##python

star

Sun Jun 01 2025 14:43:00 GMT+0000 (Coordinated Universal Time)

@nani ##python

star

Sun Jun 01 2025 14:41:15 GMT+0000 (Coordinated Universal Time)

@nani ##python

star

Sun Jun 01 2025 03:14:09 GMT+0000 (Coordinated Universal Time)

@davidmchale #rest #operator #...args

star

Sun Jun 01 2025 00:33:48 GMT+0000 (Coordinated Universal Time)

@davidmchale #maps #toggling #decision

star

Sat May 31 2025 23:37:07 GMT+0000 (Coordinated Universal Time) https://alienshanu.me/

@blackalien

star

Sat May 31 2025 21:03:41 GMT+0000 (Coordinated Universal Time) https://rustme.net/cabinet

@Kifircheck

star

Sat May 31 2025 10:20:01 GMT+0000 (Coordinated Universal Time) https://www.beleaftechnologies.com/bc-game-clone-script

@raydensmith #bc #game #bcgameclonescript

star

Sat May 31 2025 05:10:23 GMT+0000 (Coordinated Universal Time) https://freeytthumbnail.com/

@FreeYt #python

star

Fri May 30 2025 13:29:58 GMT+0000 (Coordinated Universal Time)

@moussa_29

star

Fri May 30 2025 07:51:50 GMT+0000 (Coordinated Universal Time) https://cryptocurrency-exchange-development-company.com/

@raydensmith #cryptoexchange

star

Fri May 30 2025 05:46:04 GMT+0000 (Coordinated Universal Time)

@shubhangi.b

star

Fri May 30 2025 02:01:00 GMT+0000 (Coordinated Universal Time)

@FOHWellington

star

Fri May 30 2025 01:56:28 GMT+0000 (Coordinated Universal Time)

@FOHWellington

star

Thu May 29 2025 11:03:28 GMT+0000 (Coordinated Universal Time)

@Shivam3.tyagi

star

Thu May 29 2025 10:58:44 GMT+0000 (Coordinated Universal Time)

@Shivam3.tyagi

star

Thu May 29 2025 10:02:01 GMT+0000 (Coordinated Universal Time) https://maticz.com/poker-game-development

@abiramid ##pokergame #pokergamedevelopment #pokergamedevelopmentcompany #maticz #maticzpokergamedevelopment #pokerappdevelopment

star

Thu May 29 2025 05:24:28 GMT+0000 (Coordinated Universal Time)

@shubhangi.b

star

Wed May 28 2025 09:13:07 GMT+0000 (Coordinated Universal Time) https://www.coinsclone.com/crypto-leverage-trading-platform/

@CharleenStewar #crypto leverage trading platform

star

Wed May 28 2025 08:57:43 GMT+0000 (Coordinated Universal Time)

@shubhangi.b

star

Wed May 28 2025 08:56:35 GMT+0000 (Coordinated Universal Time)

@shubhangi.b

star

Wed May 28 2025 08:56:01 GMT+0000 (Coordinated Universal Time)

@shubhangi.b

star

Wed May 28 2025 07:30:13 GMT+0000 (Coordinated Universal Time) https://www.talentrack.in/voice-over-artist-job-in-india

@Talentrack

star

Wed May 28 2025 07:18:37 GMT+0000 (Coordinated Universal Time) https://www.firekirin.xyz:8888/Store.aspx

@cholillo18

star

Wed May 28 2025 07:17:57 GMT+0000 (Coordinated Universal Time) https://www.firekirin.xyz:8888/Store.aspx

@cholillo18

star

Wed May 28 2025 06:48:09 GMT+0000 (Coordinated Universal Time)

@Saravana_Kumar #python

star

Wed May 28 2025 04:23:35 GMT+0000 (Coordinated Universal Time)

@tara.hamedani

star

Wed May 28 2025 01:24:03 GMT+0000 (Coordinated Universal Time)

@futuremotiondev #css #font #font-family #font-stack

star

Tue May 27 2025 12:28:47 GMT+0000 (Coordinated Universal Time)

@Sebhart #css #link

star

Tue May 27 2025 12:27:40 GMT+0000 (Coordinated Universal Time)

@Sebhart #css #list #order #navigation

star

Tue May 27 2025 12:26:45 GMT+0000 (Coordinated Universal Time)

@Sebhart #css #image #optimization

star

Tue May 27 2025 12:25:53 GMT+0000 (Coordinated Universal Time)

@Sebhart #css #ui

star

Tue May 27 2025 12:24:59 GMT+0000 (Coordinated Universal Time)

@Sebhart #css #button #bug

star

Tue May 27 2025 12:22:43 GMT+0000 (Coordinated Universal Time)

@Sebhart #css #selector #phone

star

Tue May 27 2025 12:21:26 GMT+0000 (Coordinated Universal Time)

@Sebhart #css #a11y #media-query

star

Tue May 27 2025 12:20:32 GMT+0000 (Coordinated Universal Time)

@Sebhart #css #image

star

Tue May 27 2025 12:19:29 GMT+0000 (Coordinated Universal Time)

@Sebhart #css #shadow

star

Tue May 27 2025 06:40:17 GMT+0000 (Coordinated Universal Time) https://www.addustechnologies.com/blog/coinmarketcap-clone-script

@Seraphina

star

Tue May 27 2025 05:57:35 GMT+0000 (Coordinated Universal Time) https://kanhasoft.com/ios-app-development.html

@kanhasoft #iosapp development #iosapp development company

star

Tue May 27 2025 05:56:48 GMT+0000 (Coordinated Universal Time) https://kanhasoft.com/product-development.html

@kanhasoft #productdevelopment #customproduct development

star

Tue May 27 2025 05:56:13 GMT+0000 (Coordinated Universal Time) https://kanhasoft.com/web-scraping-services.html

@kanhasoft #webdata scraping #datascraping services

star

Tue May 27 2025 05:55:21 GMT+0000 (Coordinated Universal Time) https://kanhasoft.com/ai-ml-development-company.html

@kanhasoft #aidevelopment #mldevelopment

star

Tue May 27 2025 05:54:39 GMT+0000 (Coordinated Universal Time) https://kanhasoft.com/cloud-saas-based-application-development.html

@kanhasoft #saasapplication #saasapplication development

star

Tue May 27 2025 05:53:35 GMT+0000 (Coordinated Universal Time) https://kanhasoft.com/erp-software-development.html

@kanhasoft #customerp software #erpsoftware development #softwaredevelopment

star

Tue May 27 2025 05:52:43 GMT+0000 (Coordinated Universal Time) https://kanhasoft.com/crm-software-development.html

@kanhasoft #customcrm software #crmsoftware development

star

Tue May 27 2025 05:51:50 GMT+0000 (Coordinated Universal Time) https://kanhasoft.com/custom-software-development.html

@kanhasoft #customsoftware development #softwaredevelopment company

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension