Snippets Collections
Sie ist die, die sich ein jeder Wichser und Spermaspritzer 
für seinen Schwanz erträumt!
Wie seht ihr das?

Welcher Wichser träumt nicht davon, von solch einer Göre mit den Worten:
"Wichst du für mich, bitte?"
zum wichsen und rumspritzen eingeladen zu werden
{
  "userId": 858,
  "firstName": "kiran",
  "lastName": "Reddy",
  "phoneCode": "+91",
  "phoneCountryId": 1,
  "phoneNumber": 9000989326,
  "emailId": "Kiranreddy@gmail.com",
  "profilePicUrl": "https://s3.ap-south-1.amazonaws.com/myassociation-dev-objects/Profile/ea008f89-872b-496a-9a60-925a8c721f01.jpg"
}
from docx import Document
import pandas as pd

df = pd.read_csv('out.csv').to_dict()
word_doc = Document()

table_head = list(df.keys())

table_head_len = len(table_head)
tables_rows_len = len(df['name'])

# create tabel
table = word_doc.add_table(cols = table_head_len, rows = tables_rows_len)

# add the first row in the table
for i in range(table_head_len):
    table.cell(row_idx = 0, col_idx = i).text = table_head[i]


# add rows for name col
for i in range(1, tables_rows_len):
    table.cell(row_idx = i, col_idx = 0).text = df['name'][i]


# add rows for age col
for i in range(1, tables_rows_len):
    table.cell(row_idx = i, col_idx = 1).text = str(df['age'][i])


word_doc.save('word_doc.docx')
<?php
/**
 * The Template for displaying product archives, including the main shop page which is a post type archive
 *
 * This template can be overridden by copying it to yourtheme/woocommerce/archive-product.php.
 *
 * HOWEVER, on occasion WooCommerce will need to update template files and you
 * (the theme developer) will need to copy the new files to your theme to
 * maintain compatibility. We try to do this as little as possible, but it does
 * happen. When this occurs the version of the template file will be bumped and
 * the readme will list any important changes.
 *
 * @see https://docs.woocommerce.com/document/template-structure/
 * @package WooCommerce\Templates
 * @version 3.4.0
 */

defined( 'ABSPATH' ) || exit;

get_header( 'shop' );

/**
 * Hook: woocommerce_before_main_content.
 *
 * @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
 * @hooked woocommerce_breadcrumb - 20
 * @hooked WC_Structured_Data::generate_website_data() - 30
 */
do_action( 'woocommerce_before_main_content' );

?>
<div class="container-fluid">
<header class="woocommerce-products-header">
	<?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?>
		<h1 class="woocommerce-products-header__title page-title"><?php woocommerce_page_title(); ?></h1>
	<?php endif; ?>

	<?php
	/**
	 * Hook: woocommerce_archive_description.
	 *
	 * @hooked woocommerce_taxonomy_archive_description - 10
	 * @hooked woocommerce_product_archive_description - 10
	 */
	do_action( 'woocommerce_archive_description' );
	?>
</header>

<div class="row">
	<div class="col-lg-3">
		<?php
		/**
		 * Hook: woocommerce_sidebar.
		 *
		 * @hooked woocommerce_get_sidebar - 10
		 */
		do_action( 'woocommerce_sidebar' );
		?>
	</div>
	<div class="col-lg-9">


<?php
if ( woocommerce_product_loop() ) {

	/**
	 * Hook: woocommerce_before_shop_loop.
	 *
	 * @hooked woocommerce_output_all_notices - 10
	 * @hooked woocommerce_result_count - 20
	 * @hooked woocommerce_catalog_ordering - 30
	 */
	do_action( 'woocommerce_before_shop_loop' );

	woocommerce_product_loop_start();

	if ( wc_get_loop_prop( 'total' ) ) {
		while ( have_posts() ) {
			the_post();

			/**
			 * Hook: woocommerce_shop_loop.
			 */
			do_action( 'woocommerce_shop_loop' );

			wc_get_template_part( 'content', 'product' );
		}
	}

	woocommerce_product_loop_end();

	/**
	 * Hook: woocommerce_after_shop_loop.
	 *
	 * @hooked woocommerce_pagination - 10
	 */
	do_action( 'woocommerce_after_shop_loop' );
} else {
	/**
	 * Hook: woocommerce_no_products_found.
	 *
	 * @hooked wc_no_products_found - 10
	 */
	do_action( 'woocommerce_no_products_found' );
}

/**
 * Hook: woocommerce_after_main_content.
 *
 * @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content)
 */
do_action( 'woocommerce_after_main_content' );

?>
	</div>
</div>
</div>
<?php

get_footer( 'shop' );

?>
Hello Customers..*Are you having troubles meeting up with you BILLS*Do you need capital to begin a small or large scale BUSINESS*Do you need EXCESS funds for PERSONAL USE*Are you suffering from health issues and you need FINANCING*Do you need a raise for that SCHOOL FEES*An improved CREDIT to apply for a LOANThis is JEANSON ANCHETA Underground ANONYMOUS Hacker providing service to customer with REAL needs at a minimal cost.. i have been underground for years now i am currently trading Bitcoin for FRESH BASE TOOLS including Hacked PayPal logs, Bank Wire & Ach logins, Wu transfer and Bug software, Credit card Top-Up, Fullz, Clone Atm skimmer, Cvv, smtp, rdp, inbox mailer, Email leads, Dumps and Warez with several Bots and Hacking tools strictly UNDERGROUND Sales.. I am selling FRESH BASE TOOLS Hacked WU Bug software and MTCN, Verizon, AT&T account, Transferwise, Hacked PayPal accounts, Bank wire logins, Money Booker, Skrill account, cc top-up, fullz, dumps+pin leads, rdp, smtp, email leads..CONTACT

G/MAIL: Jeansonancheta0518@gmail.com

WHATSAPP: +1-209-442-6951

TELEGRAM: +1-209-442-6951


https://t.me/+2__ynBAtFP00M2Fk 

All transactions are carried out offshore and has no trace backs or charge-backs here are the Rates List with Explanation :-
Western Union Transfer :-Transferring Western Union all over the world and it takes 10 - 30 minutes maximum to receive MTCN and senders info then you can pick up funds from Western union Store. (transferring all over the world)Necessary Info needed for WU transfers :-1: Full name2: Cell number (Not Necessary)3: City4:Country Western Union Transfer Rates :$1500 Transfer = $200$3000 Transfer = $300$4500 Transfer = $400$7000 Transfer = $500$10000 Transfer = $700Bank Transfers :- My responsibility is to transfer the required amount into your account after your payment from my spammed logins, we have method for making clear payment so no dispute no charge-back chances. (transferring all over the world)Info needed for Bank transfers :-1: Bank name2: Bank address3: Zip code4: Account Holder Name5: Account number6: Account Type7: Routing number Bank transfer will take maximum 3 hours for reflection..Transfer Rates :$3000 Transfer = $250 Charges$5000 Transfer = $400 Charges$9000 Transfer = $700 Charges$12000 Transfer = $1000 Charges$15000 Transfer = $1200 ChargesPayPal Transfer :- Using Verified PayPal accounts to transfer funds. This is a safe way to earn money. (transferring all over the world except banned/blacklisted countries)PayPal Transfer Rates :$3000 Transfer = $250 Charges$5000 Transfer = $400 Charges$9000 Transfer = $700 Charges$15,000 Transfer = $1200 ChargesCredit-card Top Up Rates:-$3000 Transfer = $300 Charges$5000 Transfer = $400 Charges$10,000 Transfer = $700 Charges***TERMS AND CONDITIONSA person can receive transfer as much as you desire in a week as long as you can handle your end. If anyone want to do regular business with me then you must have more than one bank account, PayPal, Money Booker and fake ids for western union. You are advised to have a safe account to transfer funds to and also withdraw for cash or make purchases online.PAYMENT METHODS INCLUDE: [ BITCOIN, ETHEREUM, PERFECT MONEY, ITUNES GIFT CARD, WESTERN UNION TRF, MONEY GRAM ]CONTACT

G/MAIL: Jeansonancheta0518@gmail.com

WHATSAPP: +1-209-442-6951

TELEGRAM: +1-209-442-6951



https://t.me/+2__ynBAtFP00M2Fk     
VERIFIED                                                *****100% SECURED*****                                                                   ADMIN                                                        (C) RESERVED 2024
<style>
.systeme-show-popup-828168 {
  background-color: #007bff; /* Change the background color */
  color: white; /* Change the text color */
  padding: 10px 20px; /* Adjust padding */
  border: none; /* Remove border */
  border-radius: 5px; /* Round the corners */
  cursor: pointer; /* Change cursor to pointer */
  text-decoration: none; /* Remove underline */
}
</style>
// always start with a function expression for the function passed into the event

const showAlert = function(e){
  		alert('Do something cool')
  		// then remove the listener
  		btn.removeEventListener(showAlert)
}

btn.addEventListener('mouseenter', showAlert)
// the oldler way
function heroBtnScroll() {

  const featuresEl = document.querySelector('#section--1');   // target element
  const featuresElPosition = featuresEl.getBoundingClientRect(); // element positioned
  console.log(featuresElPosition);
  const { top, left } = featuresElPosition; //destructure to get positions from the getBoundingClientRect()
  window.scrollTo({
    left: left,
    top: top + window.scrollY,
    behavior: 'smooth',
  });
}
const heroBtn = document.querySelector('.btn--scroll-to');
if (heroBtn) {
  heroBtn.addEventListener('click', heroBtnScroll);
}



//the newer way using scrollIntoView

function heroBtnScroll() {
  const featuresEl = document.querySelector('#section--1');
  featuresEl.scrollIntoView({ behavior: 'smooth' });
}

const heroBtn = document.querySelector('.btn--scroll-to');
if (heroBtn) {
  heroBtn.addEventListener('click', heroBtnScroll);
}




// testing scrolling behaviours with the document and the viewport in the console
window.addEventListener('scroll', () => {
  console.log('Viewport height:', document.documentElement.clientHeight);
  console.log('Vertical scroll position:', window.scrollY);
});
let heightStr = '56.54px';

let number = parseFloat(heightStr.replace('px', ''));
console.log(number)

// or on a DOM Element

 const message = document.querySelector('.message-container');
 console.log(getComputedStyle(message).height);
message.style.height =
    Number.parseFloat(getComputedStyle(message).height, 10) + 22.5 + 'px';
[02-Jul-2024 01:06:23 UTC] PHP Fatal error Uncaught Automatic_CSS\ScssPhp\Exception\SassScriptException: Incompatible units ex and px. in /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/library/ScssPhp/Node/Number.php:687

Stack trace:

#0 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/library/ScssPhp/Node/Number.php(641): Automatic_CSS\ScssPhp\Node\Number->valueInUnits()
#1 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/library/ScssPhp/Node/Number.php(618): Automatic_CSS\ScssPhp\Node\Number->coerceUnits()
#2 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/library/ScssPhp/Node/Number.php(453): Automatic_CSS\ScssPhp\Node\Number->coerceNumber()
#3 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/library/ScssPhp/Compiler.php(4058): Automatic_CSS\ScssPhp\Node\Number->plus()
#4 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/library/ScssPhp/Compiler.php(3581): Automatic_CSS\ScssPhp\Compiler->opAddNumberNumber()
#5 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/library/ScssPhp/Compiler.php(3627): Automatic_CSS\ScssPhp\Compiler->reduce()
#6 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/library/ScssPhp/Compiler.php(3650): Automatic_CSS\ScssPhp\Compiler->reduce()
#7 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/library/ScssPhp/Compiler.php(3012): Automatic_CSS\ScssPhp\Compiler->reduce()
#8 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/library/ScssPhp/Compiler.php(2411): Automatic_CSS\ScssPhp\Compiler->compileChild()
#9 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/library/ScssPhp/Compiler.php(5782): Automatic_CSS\ScssPhp\Compiler->compileChildrenNoReturn()
#10 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/library/ScssPhp/Compiler.php(2736): Automatic_CSS\ScssPhp\Compiler->importFile()
#11 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/library/ScssPhp/Compiler.php(2948): Automatic_CSS\ScssPhp\Compiler->compileImport()
#12 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/library/ScssPhp/Compiler.php(2411): Automatic_CSS\ScssPhp\Compiler->compileChild()
#13 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/library/ScssPhp/Compiler.php(5782): Automatic_CSS\ScssPhp\Compiler->compileChildrenNoReturn()
#14 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/library/ScssPhp/Compiler.php(2736): Automatic_CSS\ScssPhp\Compiler->importFile()
#15 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/library/ScssPhp/Compiler.php(2948): Automatic_CSS\ScssPhp\Compiler->compileImport()
#16 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/library/ScssPhp/Compiler.php(2411): Automatic_CSS\ScssPhp\Compiler->compileChild()
#17 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/library/ScssPhp/Compiler.php(5782): Automatic_CSS\ScssPhp\Compiler->compileChildrenNoReturn()
#18 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/library/ScssPhp/Compiler.php(2736): Automatic_CSS\ScssPhp\Compiler->importFile()
#19 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/library/ScssPhp/Compiler.php(2948): Automatic_CSS\ScssPhp\Compiler->compileImport()
#20 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/library/ScssPhp/Compiler.php(2411): Automatic_CSS\ScssPhp\Compiler->compileChild()
#21 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/library/ScssPhp/Compiler.php(767): Automatic_CSS\ScssPhp\Compiler->compileChildrenNoReturn()
#22 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/library/ScssPhp/Compiler.php(545): Automatic_CSS\ScssPhp\Compiler->compileRoot()
#23 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/classes/CSS_Engine/CSS_File.php(377): Automatic_CSS\ScssPhp\Compiler->compileString()
#24 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/classes/CSS_Engine/CSS_File.php(302): Automatic_CSS\CSS_Engine\CSS_File->get_css_from_scss()
#25 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/classes/Framework/Base.php(71): Automatic_CSS\CSS_Engine\CSS_File->save_file_from_variables()
#26 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/classes/CSS_Engine/CSS_Engine.php(167): Automatic_CSS\Framework\Base->generate_own_css_files()
#27 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/classes/CSS_Engine/CSS_Engine.php(146): Automatic_CSS\CSS_Engine\CSS_Engine->generate_all_css_files()
#28 /home/forestnation/web/staging.forestnation.com/public/wp-includes/class-wp-hook.php(324): Automatic_CSS\CSS_Engine\CSS_Engine->update_framework_css_files()
#29 /home/forestnation/web/staging.forestnation.com/public/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#30 /home/forestnation/web/staging.forestnation.com/public/wp-includes/plugin.php(517): WP_Hook->do_action()
#31 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/classes/Plugin.php(112): do_action()
#32 /home/forestnation/web/staging.forestnation.com/public/wp-includes/class-wp-hook.php(324): Automatic_CSS\Plugin->activate_plugin()
#33 /home/forestnation/web/staging.forestnation.com/public/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#34 /home/forestnation/web/staging.forestnation.com/public/wp-includes/plugin.php(517): WP_Hook->do_action()
#35 /home/forestnation/web/staging.forestnation.com/public/wp-admin/includes/plugin.php(705): do_action()
#36 /home/forestnation/web/staging.forestnation.com/public/wp-admin/plugins.php(60): activate_plugin()
#37 {main}
Next Automatic_CSS\ScssPhp\Exception\CompilerException: Incompatible units ex and px.: /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/assets/scss/modules/text/_text-default-styles.scss on line 61, at column 1 Call Stack: #0 import /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/assets/scss/modules/text/_text-default-styles.scss /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/assets/scss/modules/text/_text-vars.scss on line 1 #1 import /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/assets/scss/modules/text/_text-vars.scss /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/assets/scss/automatic-imports.scss on line 25 #2 import /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/assets/scss/automatic-imports.scss (unknown file) on line 1 in /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/library/ScssPhp/Compiler.php:596

Stack trace:

#0 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/classes/CSS_Engine/CSS_File.php(377): Automatic_CSS\ScssPhp\Compiler->compileString() #1 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/classes/CSS_Engine/CSS_File.php(302): Automatic_CSS\CSS_Engine\CSS_File->get_css_from_scss() #2 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/classes/Framework/Base.php(71): Automatic_CSS\CSS_Engine\CSS_File->save_file_from_variables() #3 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/classes/CSS_Engine/CSS_Engine.php(167): Automatic_CSS\Framework\Base->generate_own_css_files() #4 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/classes/CSS_Engine/CSS_Engine.php(146): Automatic_CSS\CSS_Engine\CSS_Engine->generate_all_css_files() #5 /home/forestnation/web/staging.forestnation.com/public/wp-includes/class-wp-hook.php(324): Automatic_CSS\CSS_Engine\CSS_Engine->update_framework_css_files() #6 /home/forestnation/web/staging.forestnation.com/public/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #7 /home/forestnation/web/staging.forestnation.com/public/wp-includes/plugin.php(517): WP_Hook->do_action() #8 /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/classes/Plugin.php(112): do_action() #9 /home/forestnation/web/staging.forestnation.com/public/wp-includes/class-wp-hook.php(324): Automatic_CSS\Plugin->activate_plugin() #10 /home/forestnation/web/staging.forestnation.com/public/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #11 /home/forestnation/web/staging.forestnation.com/public/wp-includes/plugin.php(517): WP_Hook->do_action() #12 /home/forestnation/web/staging.forestnation.com/public/wp-admin/includes/plugin.php(705): do_action() #13 /home/forestnation/web/staging.forestnation.com/public/wp-admin/plugins.php(60): activate_plugin() #14 {main} thrown in /home/forestnation/web/staging.forestnation.com/public/wp-content/plugins/automaticcss-plugin/library/ScssPhp/Compiler.php on line 596
global proc radioOptions()
{
	string $win = `window`;
	rowColumnLayout -nc 1;
	string $radioButtons = `radioButtonGrp -l "Select One" -nrb 4 -labelArray4 "One" "2" "C" "fourth" -vr -cw 1 80 -cw 2 200 -sl 1`;
	button -l "Click" -c ("radioResult "+$radioButtons);
	showWindow $win;
}

proc radioResult(string $radioButtons)
{
	int $selection = `radioButtonGrp -q -sl $radioButtons`;

	if ($selection == 2)
	{
		print "it's 2\n";
	}
	else
	{
		print "it's not 2\n";
	}
}
global proc radioDemo()
{
	string $win = `window`;
	rowColumnLayout -nc 1;
	string $radioButtonsName = `radioButtonGrp -nrb 4 -label "LABEL" -la4 "first" "second" "third" "fourth" -vr -sl 3 -cw 1 75`;
	button -label "CLICK HERE" -c ("printSelection "+$radioButtonsName);
	showWindow $win;
}
proc printSelection(string $radioButtonsName)
{
	int $selection = `radioButtonGrp -q -sl $radioButtonsName`;
	print ($selection+"\n");
}
global proc windowUsefulDemo()
{
	string $win = `window -t "Make Colourful Cubes" -wh 600 100`;
	rowColumnLayout -nc 1 -cw 1 600;
	string $amountSlider = `intSliderGrp -l "How Many?" -f 1 -cw 1 80`;
	string $colourSlider = `colorSliderGrp -l "What Colour?" -rgb 0.572002 0.838 0.069554 -cw 1 80`;
	button -l "Create" -c ("createCubes "+$amountSlider+" "+$colourSlider); // send the slider names
	button -l "Close" -c ("deleteUI -wnd "+$win); 
	showWindow $win;
}

proc createCubes(string $amountSlider, string $colourSlider) // makeCubes expects the slider names (as strings)
{
	int $num = `intSliderGrp -q -v $amountSlider`; // query the value from the intSliderGrp
	float $col[] = `colorSliderGrp -q -rgb $colourSlider`; // query the colour from the colorSliderGrp

	string $allCubes[];

	for ($c=0;$c<$num;$c++) // queried int value used here
	{
		string $cubeName[] = `polyCube -w 1 -h 1 -d 1 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1`;
		$allCubes[$c] = $cubeName[0];
	}

	string $mat = `shadingNode -asShader blinn`;
	string $sg = `sets -renderable true -noSurfaceShader true -empty -name ($mat+"SG")`;
	connectAttr -f ($mat+".outColor") ($sg+".surfaceShader");
	setAttr ($mat+".color") -type double3 $col[0] $col[1] $col[2]; // queried colour used here


	select -r $allCubes;
	string $groupName = `group`;
	select -r $groupName;
	sets -e -forceElement $sg;
}
global proc windowDoStuff()
{
	string $win = `window -t "Do Stuff" -wh 600 100`;
	rowColumnLayout -nc 1 -cw 1 600;
	string $intSlide = `intSliderGrp -l "How many?" -f 1`; // get the name of the intSlider
	button -l "Click" -c ("doStuff "+$intSlide); // send the name to the "doStuff" procedure
	showWindow $win;
}

proc doStuff(string $intSlide) // doStuff is expecting the name as an input as a string
{
	polyCube -w 1 -h 1 -d 1 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1;
	print "HEY GUYS\n";
	print ($intSlide+"\n");
	int $queriedValue = `intSliderGrp -q -v $intSlide`; // get the value from the slider
	print ($queriedValue+"\n");
}
global proc windowDemo()
{
	string $win = `window -t "Demonstration Window" -wh 900 300 -bgc 0.0745215 0.5 0.0575`;
	frameLayout -collapsable 0 -labelVisible 0 ;
		rowColumnLayout -nc 2 -cw 1 450 -cw 2 450 -rs 1 50;
			intSliderGrp -l "First Slider" -f 1 -cw 1 75 -cw 2 50 -min 1 -max 50 -v 25 -fmx 100000;
			floatSliderGrp -label "Second Slider" -f 1;
			checkBoxGrp -label "CLICK?" ;
			colorSliderGrp -label "Colour" -rgb 1 0 0;
			button -l "Create" -bgc 1 0.045 0.669426;
			button -l "Close" -bgc 1 0.461533 0;
		setParent ..;
		rowColumnLayout -nc 1 -cw 1 900;
			floatSliderGrp -label "Wide Slider" -f 1;
			floatSliderGrp -label "Next Wide Slider" -f 1;
	showWindow $win;
}

windowDemo
global proc deformerDemo()
{
	string $cyl[] = `polyCylinder -r 1 -h 100 -sx 20 -sy 50 -sz 1 -ax 0 1 0 -rcp 0 -cuv 3 -ch 1`;
	string $bend[] = `nonLinear -type bend`;
	// Result: bend1 bend1Handle
	expression -s ($bend[0]+".curvature = sin(time*4)*180;")  -o $bend[0] -ae 1 -uc all ;



}
global proc ifCubeAndSphere()
{
	string $cube[] = `polyCube -w 1 -h 1 -d 1 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1`;
	string $sphere[] = `polySphere -r 1 -sx 20 -sy 20 -ax 0 1 0 -cuv 2 -ch 1`;
	xform -t 5 0 0 $sphere[0];
	expression -s ($cube[0]+".translateY = noise(time*3)*10;")  -o $cube[0] -ae 1 -uc all ;
	expression -s ("if ("+$cube[0]+".translateY <0)\n{\n\t"
						 +$sphere[0]+".translateZ = sin(time*4)*5;\n\t"
						 +$sphere[0]+".translateY = 0;\n\n}\nelse\n{\n\t"
						 +$sphere[0]+".translateY = sin(time*4)*5;\n\t"
						 +$sphere[0]+".translateZ = 0;\n\n}")  -o $sphere[0] -ae 1 -uc all  ;

}
global proc ifExpression()
{
	polyGear -sides 16 -radius 1 -internalRadius 0.3 -height 1 -heightDivisions 10 -gearSpacing 0.6 -gearOffset 0.2 -gearTip 0.5 -gearMiddle 1.2 -twist 0 -taper 1;
	string $gear[] = `ls -sl`;


	string $mat = `shadingNode -asShader blinn`;
	string $sg = `sets -renderable true -noSurfaceShader true -empty -name ($mat+"SG")`;
	connectAttr -f ($mat+".outColor") ($sg+".surfaceShader");

	select -r $gear[0] ;
	sets -e -forceElement $sg;

	expression -s ($gear[0]+".translateY = noise(time*4)*8;\n\nif ("+$gear[0]+".translateY <0)\n{\n\t"+$mat+".colorR = 0.644999;\n\t"+$mat+".colorG = 1;\n\t"+$mat+".colorB = 0.077;\n}\nelse\n{\n\t"+$mat+".colorR = 0.729425;\n\t"+$mat+".colorG = 0.0427638;\n\t"+$mat+".colorB = 0.668304;\n}") -ae 1 -uc all ;

}
global proc turtle2021()
{
	string $shell[] = `polySphere -r 3 -sx 8 -sy 8 -ax 0 1 0 -cuv 2 -ch 1`;
	select -r ($shell[0]+".vtx[0:31]") ($shell[0]+".vtx[56]") ;
	scale -r -ocp 1 1e-05 1 ;
	string $head[] = `polyCube -w 1.5 -h 1.5 -d 1.5 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1`;
	xform -t 0 0.5 3.375 $head[0];
	
	string $feet[];
	for ($f=0;$f<4;$f++)
	{
		string $foot[] = `polyPyramid -w 3 -ns 4 -sh 1 -sc 0 -ax 0 1 0 -cuv 3 -ch 1`;
		xform -t -2.63 0 2.63 -ro 45 0 90 -s 0.188 1 0.25 $foot[0];
		xform -ws -piv 0 0 0 $foot[0];
		makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 -pn 1;
		xform -ro 0 ($f*90) 0 $foot[0];
		$feet[$f] = $foot[0];
	}
	select -r $feet $head[0] $shell[0];
	string $turtGrp = `group`;

	string $mat = `shadingNode -asShader blinn`;
	string $matSG = `sets -renderable true -noSurfaceShader true -empty -name ($mat+"SG")`;
	connectAttr -f ($mat+".outColor") ($matSG+".surfaceShader");
	select -r $turtGrp ;
	sets -e -forceElement $matSG;
	setAttr ($mat+".color") -type double3 0 0.178 0.0273853 ;

	string $ground[] = `polyPlane -w 100 -h 100 -sx 10 -sy 10 -ax 0 1 0 -cuv 2 -ch 1`;
	string $loc[] = `spaceLocator -p 0 1.5 0`;
	select -r $shell[0] $loc[0];
	parentConstraint -mo -weight 1;

	xform -t 0 54 0 -ro 32 5 -25 $turtGrp;
	select -r $turtGrp;
	rigidBody -active -m 1 -dp 0 -sf 0.2 -df 0.2 -b 0.6 -l 0 -tf 200 -iv 0 0 0 -iav 0 0 0 -c 0 -pc 0 -i 0 0 0 -imp 0 0 0 -si 0 0 0 -sio none ;
	select -r $ground[0] ;
	rigidBody -passive -m 1 -dp 0 -sf 0.2 -df 0.2 -b 0.6 -l 0 -tf 200 -iv 0 0 0 -iav 0 0 0 -c 0 -pc 0 -i 0 0 0 -imp 0 0 0 -si 0 0 0 -sio none ;
	string $grav[] = `gravity -pos 0 0 0 -m 9.8 -att 0 -dx 0 -dy -1 -dz 0  -mxd -1  -vsh none -vex 0 -vof 0 0 0 -vsw 360 -tsr 0.5 `;
	connectDynamic -f $grav[0] $turtGrp;


	expression -s ("if ("+$loc[0]+".translateY < 4)\n{\nsetAttr \""+$mat+".color\" -type double3 1 0 0 ;\n}\nelse\n{\nsetAttr \""+$mat+".color\" -type double3 0 0.178 0.0273853 ;\n}")  -o $mat -ae 1 -uc all  ;

}
/********************************************************

	De-select a precentage of the selected Items

	Brian Samuels


********************************************************/

global proc selPercent(int $percent)
{

string $selected[] = `ls -sl -fl`;
string $sel;
int $rnd;
	for($sel in $selected)
	{
		$rnd = `rand 0 100`;
		if($rnd> $percent)
		{
			select -d $sel;

		}
	}

}

global proc colourDemo()
{
////////////////////  SOLID COLOUR /////////////////////
	string $sphere1[] = `polySphere -r 1 -sx 20 -sy 20 -ax 0 1 0 -cuv 2 -ch 1`;
	xform -t -5 0 0 $sphere1[0];

	// Create material
	string $mat1 = `shadingNode -asShader blinn`;
	// Result: blinn1 // 
	string $sg1 = `sets -renderable true -noSurfaceShader true -empty -name ($mat1+"SG")`;
	// Result: blinn1SG // 
	connectAttr -f ($mat1+".outColor") ($sg1+".surfaceShader");
	// Result: Connected blinn1.outColor to blinn1SG.surfaceShader. // 

	// Select sphere and assign the material
	select -r $sphere1[0] ;
	sets -e -forceElement $sg1;

	// Set the colour to stunning lime green
	setAttr ($mat1+".color") -type double3 0.644999 1 0.077 ;

///////////////////// RANDOM SOLID COLOUR ///////////////

	string $sphere2[] = `polySphere -r 1 -sx 20 -sy 20 -ax 0 1 0 -cuv 2 -ch 1`;

	string $mat2 = `shadingNode -asShader phong`;
	string $sg2 = `sets -renderable true -noSurfaceShader true -empty -name ($mat2+"SG")`;
	connectAttr -f ($mat2+".outColor") ($sg2+".surfaceShader");

	select -r $sphere2[0] ;
	sets -e -forceElement $sg2;

	// Generate postive random numbers between 0 and 1
	float $randCol[] = abs(sphrand(1));

	setAttr ($mat2+".color") -type double3 $randCol[0] $randCol[1] $randCol[2];

///////////////// ANIMATED COLOUR WITH EXPRESSION /////////////////////////////

	string $sphere3[] = `polySphere -r 1 -sx 20 -sy 20 -ax 0 1 0 -cuv 2 -ch 1`;
	xform -t 5 0 0 $sphere3[0];

	string $mat3 = `shadingNode -asShader lambert`;
	string $sg3 = `sets -renderable true -noSurfaceShader true -empty -name ($mat3+"SG")`;
	connectAttr -f ($mat3+".outColor") ($sg3+".surfaceShader");

	select -r $sphere3[0] ;
	sets -e -forceElement $sg3;


	expression -s ($mat3+".colorR = abs(noise(time));\n"
				  +$mat3+".colorG = abs(noise(time*2));\n"
				  +$mat3+".colorB = abs(sin(time*3));")  -o $mat3 -ae 1 -uc all  ;


}
/***********************************************************
tooManyCatsAnim.mel  

Creates user-specified number of cats, in a group of a
user-specified radius.


USAGE: tooManyCatsAnim <int numberOfCats> <float groupRadius>
***********************************************************/

global proc tooManyCatsAnim(int $num, float $radius)
{
	string $groupList[0]; // declare an array to save the names of all the cat groups

	for ($i=0;$i<$num;$i++) // loop to create the cats
	{
		// create and position body
		string $body[] = `polyCylinder -r 1 -h 4 -sx 10 -sy 1 -sz 1 -ax 0 1 0 -rcp 0 -cuv 3 -ch 1`;
		xform -ro 90 0 0 -t 0 2.5 0 $body[0];
		// select the CVs on the front of the body and scale and move them
		select -r ($body[0]+".vtx[10:19]") ($body[0]+".vtx[21]") ;
		scale -r -p -5.96046e-008cm 2.5cm 2cm 0.725606 0.725606 0.725606 ;
		move -r -os -wd 0 0 0.215202 ;
		//create and position head
		string $head[] = `polyPyramid -w 1 -ns 4 -sh 1 -sc 0 -ax 0 1 0 -cuv 3 -ch 1`;
		xform -t 0 3.8 2.8 -ro 90 0 45 -s 1.6 2.3 1.6 $head[0];
		// create and position ears
		string $ear1[] = `polyCone -r 1 -h 2 -sx 6 -sy 1 -sz 0 -ax 0 1 0 -rcp 0 -cuv 3 -ch 1`;
		string $ear2[] = `polyCone -r 1 -h 2 -sx 6 -sy 1 -sz 0 -ax 0 1 0 -rcp 0 -cuv 3 -ch 1`;
		xform -t -0.45 4.85 2.2 -ro 0 0 12.8 -s 0.3 0.55 0.16 $ear1[0];
		xform -t 0.45 4.85 2.2 -ro 0 0 -12.8 -s 0.3 0.55 0.16 $ear2[0];

		parent $ear1[0] $ear2[0] $head[0];
		parent $head[0] $body[0];
		select -r $body[0];
		makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 -pn 1;

		xform -ws -piv 0 3 2 $head[0];
		float $headFreq = rand(2,4);
		float $headRange = rand(10,30);
		float $bodyFreq = rand(4,7);
		float $bodyBounce = rand(0.1,0.3);
		expression -s ($head[0]+".rotateY = noise(time*"+$headFreq+")*"+$headRange+";") -ae 1 -uc all;
		expression -s ($body[0]+".translateY = abs(sin(time*"+$bodyFreq+"))*"+$bodyBounce) -ae 1 -uc all;

		// create tail
		string $tail[] = `polyCylinder -r 0.15 -h 3.5 -sx 8 -sy 16 -sz 1 -ax 0 1 0 -rcp 0 -cuv 3 -ch 1`;
		// move the pivot point to the bottom, so it bends from the bum
		xform -ws -piv 0 -1.75 0 $tail[0];		
		xform -t 0 4.96 -1.78 $tail[0];

		// deformer variables
		float $curv = rand(50,180); // random curvature for the BEND deformer
		float $wavelength = rand(2,5); // random wavelength for the SINE deformer
		float $amp = rand(0.1,0.3); // random amplitude for the SINE deformer
		float $yrot = rand(-360,360); // random Y rotation
		float $freq = rand(2,5); // time multiplier


		if ($i%2==1) // if the loop counter is ODD, add a bend to the tail
		{
			string $bend[] = `nonLinear -type bend  -lowBound 0 -highBound 1 -curvature 0`;
			expression -s ($bend[0]+".curvature = sin(time*"+$freq+")*"+$curv) -ae 1 -uc all;

			xform -ro 0 $yrot 0 $bend[1];
			parent $bend[1] $tail[0];
			parent $tail[0] $body[0];
		}
		else if ($i%2==0) // if the loop counter is EVEN, add a sine to the tail
		{
			string $sine[] = `nonLinear -type sine -lowBound -1 -highBound 1 -amplitude $amp -wavelength $wavelength -dropoff 1 -offset 0`;
			expression -s ($sine[0]+".offset = -time*"+$freq) -ae 1 -uc all ;

			xform -ro 0 $yrot 0 $sine[1];
			parent $sine[1] $tail[0];
			parent $tail[0] $body[0];
		}
		float $tailAngle = rand(-50,0);
		xform -ro $tailAngle 0 0 $tail[0];

		string $legs[]; // declare an array to save all the names of the legs
		for ($r=0;$r<4;$r++) // loop to create the legs, and gather their names
		{
			string $leg[] = `polyCube -w 0.5 -h 2 -d 0.5 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1`;
			xform -ws -piv 0 1 0 $leg[0]; // set the pivot points, so they bend from the shoulders/hips
			float $legFreq = rand(2,6);
			float $legRadius = rand(5,30);
			int $flip = rand(2);
			if ($flip == 0)
			{
				$legFreq = -$legFreq;
			}
			expression -s ($leg[0]+".rotateX = sin(time*"+$legFreq+")*"+$legRadius+";\n"+$leg[0]+".rotateZ = cos(time*"+$legFreq+")*"+$legRadius+";") -ae 1 -uc all;
			$legs[$r] = $leg[0];
		}
		// move the legs
		xform -t 0.5 0.5 1.5 $legs[0];
		xform -t 0.5 0.5 -1.5 $legs[1];
		xform -t -0.5 0.5 1.5 $legs[2];
		xform -t -0.5 0.5 -1.5 $legs[3];

		// group all the parts together
		select -r $body[0] $legs;
		string $groupName = `group`;

		// position variables
		float $trans[] = sphrand($radius);
		xform -t $trans[0] 0 $trans[2];

		// rotation variables
		float $rotationOffset = rand(-360,360);
		float $noiseAmt = rand(20,60);
		float $timeMult = rand(3);

		expression -s ($groupName+".rotateY = noise(time*"+$timeMult+")*"+$noiseAmt+"+"+$rotationOffset+";") -ae 1 -uc all;
		select -cl;
	}


}
/******************************************************
walkingFella.mel

Makes a guy who walks via animation expressions. 
User may choose clothing accessories.

USAGE: walkingFella <int hat> <int bowtie>
******************************************************/

global proc walkingFella(int $hatSel, int $btieSel)
{
	// Create all the Man's geo
	string $head[] = `polySphere -r 1 -sx 8 -sy 8 -ax 0 1 0 -cuv 2 -ch 1`;
	xform -t 0 8 0 $head[0];
	string $body[] = `polyCube -w 3 -h 3 -d 1 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1`;
	xform -t 0 5.3 0 $body[0];
	select -r ($body[0]+".vtx[0:1]") ($body[0]+".vtx[6:7]") ;
	scale -r -p 0cm 3.8cm 0cm 0.744391 1 1 ;
	string $leg1[] = `polyCylinder -r 0.4 -h 3.5 -sx 8 -sy 1 -sz 1 -ax 0 1 0 -rcp 0 -cuv 3 -ch 1`;
	xform -t -0.5 1.8 0 $leg1[0];
	xform -ws -piv -0.5 3.55 0 $leg1[0];
	string $leg2[] = `polyCylinder -r 0.4 -h 3.5 -sx 8 -sy 1 -sz 1 -ax 0 1 0 -rcp 0 -cuv 3 -ch 1`;
	xform -t 0.5 1.8 0 $leg2[0];
	xform -ws -piv 0.5 3.55 0 $leg2[0];
	string $arm1[] = `polyCylinder -r 0.3 -h 3 -sx 8 -sy 1 -sz 1 -ax 0 1 0 -rcp 0 -cuv 3 -ch 1`;
	xform -t -1.6 5.1 0 $arm1[0];
	xform -ws -piv -1.6 6.6 0 $arm1[0];
	string $arm2[] = `polyCylinder -r 0.3 -h 3 -sx 8 -sy 1 -sz 1 -ax 0 1 0 -rcp 0 -cuv 3 -ch 1`;
	xform -t 1.6 5.1 0 $arm2[0];
	xform -ws -piv 1.6 6.6 0 $arm2[0];

	// Add expressions
	expression -s ($leg1[0]+".rotateX = sin(time*4)*45;") -ae 1 -uc all ;
	expression -s ($leg2[0]+".rotateX = -sin(time*4)*45;") -ae 1 -uc all ;
	expression -s ($arm1[0]+".rotateX = -sin(time*4)*20;") -ae 1 -uc all ;
	expression -s ($arm2[0]+".rotateX = sin(time*4)*20;") -ae 1 -uc all ;

	// Create a group for the head. If Hat is selected, the hat will be parented.
	select -r $head[0];
	string $headGroup = `group`;
	xform -ws -piv 0 7 0 $headGroup;
	// Create a group for the body, in case bowtie is selected.
	select -r $body[0];
	string $bodyGroup = `group`;

	// Optional Hat creation

	if ($hatSel == 1)
	{
		string $hat[] = `polyCylinder -r 0.75 -h 1.5 -sx 12 -sy 2 -sz 1 -ax 0 1 0 -rcp 0 -cuv 3 -ch 1`;
		xform -t 0 9.5 0 $hat[0];
		select -r ($hat[0]+".e[12:23]");
		xform -r -t 0 -0.398477 0;
		string $extrude1[] = `polyExtrudeFacet -constructionHistory 1 -keepFacesTogether 1 -pvx 0 -pvy 8.925761506 -pvz 0 -divisions 1 -twist 0 -taper 1 -off 0 -thickness 0 -smoothingAngle 30 ($hat[0]+".f[0:11]")`;
		setAttr ($extrude1[0]+".localTranslate") -type double3 0 0 0.422521 ;
		parent $hat[0] $headGroup;

		string $hatShad = `shadingNode -asShader blinn`;
		sets -renderable true -noSurfaceShader true -empty -name ($hatShad+"SG");
		connectAttr -f ($hatShad+".outColor") ($hatShad+"SG.surfaceShader");

		// Create a ramp to make a red ribbon around the hat.
		string $rampTex = `shadingNode -asTexture ramp`;
		string $p2dt = `shadingNode -asUtility place2dTexture`;
		connectAttr ($p2dt+".outUV") ($rampTex+".uv");
		connectAttr ($p2dt+".outUvFilterSize") ($rampTex+".uvFilterSize");
		connectAttr -f ($rampTex+".outColor") ($hatShad+".color");
		// Adjust the ramp settings
		setAttr ($rampTex+".interpolation") 0;
		setAttr ($rampTex+".colorEntryList[0].position") 0.510836;
		setAttr ($rampTex+".colorEntryList[1].position") 0.569659;
		setAttr ($rampTex+".colorEntryList[2].position") 0;
		setAttr ($rampTex+".colorEntryList[0].color") -type double3 0.551 0 0;
		setAttr ($rampTex+".colorEntryList[1].color") -type double3 0 0 0;
		setAttr ($rampTex+".colorEntryList[2].color") -type double3 0 0 0;

		select -r $hat[0];
		sets -e -forceElement ($hatShad+"SG");

	}
	// Optional Bowtie

	if ($btieSel == 1)
	{
		string $bowtie[] = `polyCube -w 1 -h 0.5 -d 0.2 -sx 2 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1`;
		select -r ($bowtie[0]+".e[12]") ($bowtie[0]+".e[18]") ;
		scale -r -p 0cm 0cm 0cm 1 0.251157 1 ;
		xform -t 0 6.5 0.7 $bowtie[0];
		parent $bowtie[0] $bodyGroup;
		// Add red bowtie shader
		string $btShad = `shadingNode -asShader blinn`;
		sets -renderable true -noSurfaceShader true -empty -name ($btShad+"SG");
		connectAttr -f ($btShad+".outColor") ($btShad+"SG.surfaceShader");
		setAttr ($btShad+".color") -type double3 0.551 0 0 ;
		select -r $bowtie[0];
		sets -e -forceElement ($btShad+"SG");

	}

	// Add expression to the Head / Hat.
	expression -s ($headGroup+".translateY = abs(sin(time*4))*0.2;\n"
				  +$headGroup+".rotateZ = sin(time*4)*10;") -ae 1 -uc all ;
	
	// Group body, head and arms. Add expression.
	select -r $headGroup $bodyGroup $arm1[0] $arm2[0];
	string $bodyGroupAnim = `group`;
	expression -s ($bodyGroupAnim+".translateY = abs(sin(time*4)*0.1);\n"
				  +$bodyGroupAnim+".rotateY = sin(time*4)*10;") -ae 1 -uc all ;

	select -r $leg1[0] $leg2[0] $bodyGroupAnim;
	group -n "walkingFella";
	select -cl;

}
global proc makeCarPivotAnimGroup()
{
	string $car[] = `polyCube -w 1 -h 0.7 -d 3 -sx 1 -sy 1 -sz 3 -ax 0 1 0 -cuv 4 -ch 1`;

	string $extrude[] = `polyExtrudeFacet -constructionHistory 1 -keepFacesTogether 1 -pvx 0 -pvy 0.349999994 -pvz 0 -divisions 1 -twist 0 -taper 1 -off 0 -thickness 0 -smoothingAngle 30 ($car[0]+".f[2]")`;
	// Result: polyExtrudeFace1 // 
	setAttr ($extrude[0]+".localTranslate") -type double3 0 0 0.62778 ;

	string $wheels1[] = `polyCylinder -r 1 -h 2 -sx 20 -sy 1 -sz 1 -ax 0 1 0 -rcp 0 -cuv 3 -ch 1`;
	xform -t 0.013 -0.301 0.854 -ro 0 0 90 -s 0.449 0.695 0.449 $wheels1[0];
	string $wheels2[] = `polyCylinder -r 1 -h 2 -sx 20 -sy 1 -sz 1 -ax 0 1 0 -rcp 0 -cuv 3 -ch 1`;
	xform -t 0.013 -0.301 -0.854 -ro 0 0 90 -s 0.449 0.695 0.449 $wheels2[0];

	select -r $car[0] $wheels1[0] $wheels2[0];
	string $groupName = `group`;

	xform -t -10 0 0 $groupName;
	xform -ws -piv 0 0 0 $groupName;

	expression -s ($groupName+".rotateY = frame*5")  -o $groupName -ae 1 -uc all ;

}
makeCarPivotAnimGroup;
global proc splode(int $num, float $speed)
{

	for ($p=0;$p<$num;$p++)
	{
		float $randTrans[] = sphrand($speed);
		string $cube[] = `polyCube -w 1 -h 1 -d 1 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1`;
		expression -s ($cube[0]+".translateX = time*"+$randTrans[0]+";\n"
					  +$cube[0]+".translateY = time*"+$randTrans[1]+";\n"
					  +$cube[0]+".translateZ = time*"+$randTrans[2]+";")  -o $cube[0] -ae 1 -uc all  ;
	}
}
/*******************************************************
ballBounceRand.mel 
Creates a line of bouncing balls.

USAGE: ballBounceRand <int numberOfBalls>
********************************************************/
global proc ballBounceRand(int $num)
{
	string $allBalls[];

	for ($x=0;$x<$num;$x++)
	{
		float $freq = rand(3,5); // random frequency
		float $height = rand(5,20); // random height
		string $ball[] = `polySphere -r 1 -sx 20 -sy 20 -ax 0 1 0 -cuv 2 -ch 1`;
		xform -t ($x*3) 0 0 $ball[0]; // use counter to spread the ball out on the X axis 
		expression -s ($ball[0]+".translateY = abs(sin(time*"+$freq+")*"+$height+");\n"
					  +$ball[0]+".translateZ = time*4;")  -o $ball[0] -ae 1 -uc all ;
		$allBalls[$x] = $ball[0];	
	}

	select -r $allBalls;
	group;
}
global proc counterDemo()
{
	for ($i=0;$i<10;$i++)
	{
		string $cube[] = `polyCube -w 1 -h 1 -d 1 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1`;
		xform -t ($i*2) $i 0 $cube[0];
	}

}
global proc ballBounce()
{
	string $ball[] = `polySphere -r 1 -sx 20 -sy 20 -ax 0 1 0 -cuv 2 -ch 1`;
	expression -s ($ball[0]+".translateY = abs(sin(time*4)*10);\n"
				  +$ball[0]+".translateZ = time*4;")  -o $ball[0] -ae 1 -uc all ;

}
public class Payment
{
    [Key]
    public int Payment_ID { get; set; }

    [Required]
    public decimal Amount { get; set; }

    [Required]
    public DateTime Payment_Date { get; set; }

    public int Contract_ID { get; set; }

    [ForeignKey(nameof(Contract_ID))]

    public Contract Contract { get; set; }



    public int Payment_Type_ID { get; set; }



    [ForeignKey(nameof(Payment_Type_ID))]

    public Payment_Type Payment_Type { get; set; }
}

//appDbContext
var Payments = new Payment[]
{
  new Payment { Payment_ID = 1, Amount = 50.00m, Payment_Date = new DateTime(2024, 4, 12), Contract_ID = 1, Payment_Type_ID = 1 }
};
builder.Entity<Payment>().HasData(Payments);
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

flutter_application_path = 'my_flutter_module'
load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')


target 'DogBreeds' do
    use_frameworks!

    install_all_flutter_pods(flutter_application_path)
end


post_install do |installer|
    flutter_post_install(installer) if defined?(flutter_post_install)
end
Maticz is a leading On Demand App Development Company that specializes in developing premium mobile applications for businesses of all sizes. They provide a comprehensive suite of features in their admin dashboard, that includes pricing and commission management, analytics and reporting, service tracking, service provider management, and reviews and feedback.

As a full-service On Demand app solutions, Maticz provides a wide range of services beyond just on demand app development that includes web development, ecommerce soluitons, digital marketing, and blockchain development. They have a proven track record of delivering innovative, tailor-made digital solutions that assist businesses to gain a competitive edge.

Get a live free demo along with guidelines via,

Email: sales@maticz.com
Whatsapp: +91 93845 87998
Telegram: @maticzofficial
Skype: live:.cid.817b888c8d30b212
{
  "associationId": 0,
  "associationTypeId": 3,
  "associationIndustryId": 12,
  "associationCategoryTypeId": 75,
  "name": "Addidas welfare",
  "address1": "Krishna Garden Marg, Akshay Patra Chouraha, Mahal Scheme, Jagatpura, Jaipur, Rajasthan, India",
  "address2": "",
  "cityId": 1,
  "stateId": 32,
  "countryId": 1,
  "registrationDate": "1998-06-29T10:02:27.873Z",
  "website": "https://www.Addidas welfare.org/contact-us",
  "contactEmailId": "giresh@gmail.com",
  "phonecode": "+91",
  "phoneCountryId": 0,
  "contactPhoneNumber": 8989562355,
  "secondaryEmailId": "",
  "secondaryPhonecode": "",
  "secondaryPhoneNumber": 0,
  "logoUrl": "https://s3.ap-south-1.amazonaws.com/myassociation-dev-objects/Akshaya/Akshya(9).jpeg",
  "coverPicUrl": "",
  "registrationActId": 196,
  "memberSizeRangeId": 13,
  "memberSizeRangeValue": "100-1000",
  "currentMemberCount": 0,
  "members": [
    {
         "userId":0,
         "firstName":"Sukesh",
         "emailId":"Sukesh@gmail.com",
         "associationMemberId":0,
         "registrationNumber":"MJSJ8877"
      },
      {
         "userId":0,
         "firstName":"Leon",
         "emailId":"Leonaplha@gmail.com",
         "associationMemberId":0,
         "registrationNumber":"OOWJDH884"
      },
      {
         "userId":0,
         "firstName":"Sem",
         "phonecode":"+91",
         "phoneNumber":9876543218,
         "emailId":"Sem@gmail.com",
         "associationMemberId":0,
         "registrationNumber":"OEIEN88383"
    }
  ],
  "referralCode": "",
  "about": "The Addidas welfare Foundation has evolved and adapted to changing times over the last two decades,",
  "geolocation": {
    "x": 15.5622086,
    "y": 73.74929399999999
  },
  "registrationActName": "Club Licensing Act, 2008",
  "chapterTypeId": 162,
  "chapterType": ""
}
{
  "eventId": 0,
  "associationId": 41,
  "eventTypeId": 2,
  "title": "Future Forum 2025",
  "description": "A global forum dedicated to discussions and innovations in sustainability, renewable energy, and environmental protection.",
  "cityId": 148013,
  "stateId": 32,
  "countryId": 1,
  "eventModeId": 45,
  "registrationStartDate": "2024-06-29T06:32:21.324Z",
  "registrationEndDate": "2024-06-18T06:32:21.324Z",
  "eventStartDate": "2024-07-02T06:32:21.324Z",
  "eventEndDate": "2024-07-03T06:32:21.324Z",
  "broucherUrl": "",
  "address": "Madhapur",
  "videoUrl": "https://youtube.com/shorts/t6SLjTQbPh0?si=gJ9_eiYVqS3JFsGJ",
  "eventStatusId": 0,
  "phoneCode": "+91",
  "phoneCountryId": 1,
  "contactNumber": "7898561235",
  "contactEmail": "contact@sustainablefuture.com",
  "webSite": "https://sustainablefutureforum.com",
  "geolocation": {
    "x": 17.419791987251436,
    "y": 78.32488111758651
  },
  "isFreeEvent": true,
  "bannerUrls": [
    "https://s3.ap-south-1.amazonaws.com/myassociation-dev-objects/events pictures/download (5).jpeg"
  ],
  "organizingGroups": [
    25
  ],
  "eventRegistrationDetails": [
    {
      "eventRegistrationDetailId": 0,
      "eventId": 0,
      "isFoodProvided": true,
      "isAccommodationProvided": true,
      "isTransportProvided": true,
      "title": "Early Bird Registration",
      "applicableTillDate": "2024-07-01T11:44:37.842Z",
      "applicableRegistrationFee": 5000,
      "applicableCurrencyCode": "INR",
      "onspotCurrencyCode": "INR",
      "applicableCurrencyCountryId": "1",
      "onspotCurrencyCountryId": "1",
      "onSpotRegistrationFee": 2000,
      "registeredMembers": 0
    }
  ],
  "agenda": [
    {
      "eventAgendaId": 0,
      "eventId": 0,
      "title": "The Future of AI in India",
     "description": "An in-depth look at the future of artificial intelligence in India and its potential impact on various sectors.",
     "agendaDate": "2024-06-01T12:42:32.972Z",
     "startTime": "10:00:00",
     "endTime": "16:00:00",
     "presenters": [
    11,15
   ],
 "presentersDetails": ""
 }
  ],
  "eventGuidelines": {
    "eventGuidelineId": 0,
    "eventId": 0,
    "registrationGuidelines": "Participants are encouraged to pre-register for the event",
    "cancellationGuidelines": "Clearly communicate the reason for the cancellation",
    "importantGuidelines": "Prioritize the safety and wellbeing of attendees"
  },
  "eventAccountInfo": {
    "eventAccountInfoId": 0,
    "eventId": 0,
    "name": " SustainableFutureForum ",
    "bankName": "Vijaya Bank",
    "bankAccountNumber": "85986263569",
    "bankRoutingTypeId": 46,
    "bankRoutingType": "IFSC",
    "bankRoutingCode": "Vijaya12358",
    "isOrgAccount": true,
    "bankingPaymentTypeId": 170
  },
  "hasRegistered": true,
  "bannerUrlsString": "",
  "eventType": "Workshop",
  "eventMode": "Hybrid"
}
Regular expressions, often shortened to "regex" or "regexp", are patterns that help programmers match, search, and replace text. Regular expressions are powerful, but can be difficult to understand because they use so many special characters.

Your first regular expression will be used to catch help requests. Declare a helpRegex variable, and assign it a regular expression that matches the string please help.

As a refresher, here is a regular expression to match the string hello world:

Example Code
const regex = /hello world/;

Regular expressions can take flags to modify their behavior. For instance, the i flag can be used to make the expression ignore case, causing it to match hello, HELLO, and Hello for the expression /hello/.

Flags are added after the trailing slash. 

Strings have a .match() method, which accepts a regular expression as an argument and determines if the string matches that expression.

Instead of using the .match() method, you can use the .test() method of a regular expression to test if a string matches the pattern. Unlike .match(), .test() returns a boolean value indicating whether or not the string matches the pattern.

The alternate sequence | can be used to match either the text on the left or the text on the right of the |. For example, the regular expression /yes|no/ will match either yes or no.

A character class is defined by square brackets, and matches any character within the brackets. For example, [aeiou] matches any character in the list aeiou. You can also define a range of characters to match using a hyphen. For example, [a-z] matches any character from a to z.

The value may be more than one digit. To match this, the + quantifier can be used - this matches one or more consecutive occurrences. For example, the regular expression /a+/ matches one or more consecutive a characters.

A capture group is a way to define a part of the expression that should be captured and saved for later reference. You can define a capture group by wrapping a part of your expression in parentheses. For example, /h(i|ey) camper/ would match either hi camper or hey camper, and would capture i or ey in a group.

Now that you have your capture group, you can mark the entire pattern as an optional match. The ? quantifier matches zero or one occurrence of the preceding character or group. For example, the regular expression /colou?r/ matches both color and colour, because the u is optional.

One last thing with this expression. You don't actually need the match value from your capture group, so you can turn it into a non-capturing group. This will allow you to group the characters together without preserving the result.

To create a non-capturing group in a regular expression, you can add ?: after the opening parenthesis of a group. For instance, (?:a|b) will match either a or b, but it will not capture the result.

Your regex should match whole words, not partial words. That is, you do not want to match hands-free money management.

To do this, start by checking for spaces before and after your pattern. You can do this by using the meta character \s, which will match spaces, tabs, and line breaks.

Like the ^ anchor, you can use the $ anchor to match the end of the string.
[Route("api/[controller]")]
[ApiController]
public class PaymentController : ControllerBase
{
    private readonly AppDbContext _context;

    public PaymentController(AppDbContext context)
    {
        _context = context;
    }

    // 8.1 Make Payment
    [HttpPost("make-payment")]
    public async Task<IActionResult> MakePayment([FromBody] Payment payment)
    {
        if (!ModelState.IsValid)
        {
            return BadRequest(ModelState);
        }

        _context.Payments.Add(payment);
        await _context.SaveChangesAsync();

        return CreatedAtAction(nameof(ViewPaymentStatus), new { paymentId = payment.Payment_ID }, payment);
    }

    // 8.2 Upload Proof Of Payment
    [HttpPost("upload-proof-of-payment/{paymentId}")]
    public async Task<IActionResult> UploadProofOfPayment(int paymentId, IFormFile file)
    {
        var payment = await _context.Payments.FindAsync(paymentId);
        if (payment == null)
        {
            return NotFound("Payment not found.");
        }

        if (file == null || file.Length == 0)
        {
            return BadRequest("Invalid file.");
        }

        var filePath = Path.Combine("ProofOfPayments", $"{paymentId}_{file.FileName}");

        using (var stream = new FileStream(filePath, FileMode.Create))
        {
            await file.CopyToAsync(stream);
        }

        // Assuming you have a field to store the proof of payment path
        // payment.ProofOfPaymentPath = filePath; // Uncomment and add this field to the Payment model
        _context.Entry(payment).State = EntityState.Modified;
        await _context.SaveChangesAsync();

        return Ok(new { FilePath = filePath });
    }

    // 8.3 Search Payment
    [HttpGet("search-payment")]
    public async Task<IActionResult> SearchPayment([FromQuery] string searchTerm)
    {
        var payments = await _context.Payments
            .Include(p => p.Contract)
            .Include(p => p.Payment_Type)
            .Where(p => p.Contract.Description.Contains(searchTerm) ||
                        p.Payment_Type.Payment_Type_Name.Contains(searchTerm))
            .ToListAsync();

        if (payments == null || !payments.Any())
        {
            return NotFound("No payments found matching the search term.");
        }

        return Ok(payments);
    }

    // 8.4 View Payment Status
    [HttpGet("view-payment-status/{paymentId}")]
    public async Task<IActionResult> ViewPaymentStatus(int paymentId)
    {
        var payment = await _context.Payments
            .Include(p => p.Contract)
            .Include(p => p.Payment_Type)
            .FirstOrDefaultAsync(p => p.Payment_ID == paymentId);

        if (payment == null)
        {
            return NotFound("Payment not found.");
        }

        return Ok(new
        {
            payment.Payment_ID,
            payment.Amount,
            payment.Payment_Date,
            ContractDescription = payment.Contract.Description,
            PaymentTypeName = payment.Payment_Type.Payment_Type_Name,
            // payment.ProofOfPaymentPath // Uncomment if this field is added to the Payment model
        });
    }
}
https://docs.google.com/spreadsheets/d/1sA8p5Qr5c_wzZ7_PMM7bxn2otFEsIkf8xO6FlbbsZms/edit?gid=1395393155#gid=1395393155
const long long N = 2 * 1e5 + 2;

long long tree[4 * N], v[N];

void build(long long node, long long st, long long e)
{
    if (st == e)
    {
        tree[node] = v[st];
        return;
    }

    long long mid = (st + e) / 2;
    build(2 * node, st, mid);
    build(2 * node + 1, mid + 1, e);

    tree[node] = tree[2 * node] + tree[2 * node + 1];
}

long long query(long long node, long long st, long long e, long long l, long long r)
{
    if (l > e || r < st)
        return 0;

    if (l <= st && r >= e)
        return tree[node];

    long long mid = (st + e) / 2;
    long long left = query(2 * node, st, mid, l, r);
    long long right = query(2 * node + 1, mid + 1, e, l, r);

    return left + right;
}

void update(long long node, long long st, long long e, long long ind, long long val)
{
    if (st == e)
    {
        v[st] = val;
        tree[node] = val;
        return;
    }

    long long mid = (st + e) / 2;
    if (ind <= mid)
    {
        update(2 * node, st, mid, ind, val);
    }
    else
    {
        update(2 * node + 1, mid + 1, e, ind, val);
    }

    tree[node] = (tree[2 * node] + tree[2 * node + 1]);
}
Cannot GET /roadmap.pdf
<script>
    document.addEventListener("scroll", function() {


    if (document.body.scrollTop > 300 || document.documentElement.scrollTop > 300) {
        document.querySelector('.footer-button').classList.remove('d-none')
    } else {

        document.querySelector('.footer-button').classList.add('d-none')

    }
})

</script>
{
  "associationId": 41,
  "associationTypeId": 3,
  "associationIndustryId": 12,
  "associationCategoryTypeId": 75,
  "name": "Addidas welfare",
  "address1": "Krishna Garden Marg, Akshay Patra Chouraha, Mahal Scheme, Jagatpura, Jaipur, Rajasthan, India",
  "address2": "",
  "cityId": 148013,
  "stateId": 32,
  "countryId": 1,
  "registrationDate": "1998-06-29T10:02:27.873Z",
  "website": "https://www.Addidas welfare.org/contact-us",
  "contactEmailId": "giresh@gmail.com",
  "phonecode": "+91",
  "phoneCountryId": 0,
  "contactPhoneNumber": 8989562355,
  "secondaryEmailId": "",
  "secondaryPhonecode": "",
  "secondaryPhoneNumber": 0,
  "logoUrl": "https://s3.ap-south-1.amazonaws.com/myassociation-dev-objects/Akshaya/Akshya(9).jpeg",
  "coverPicUrl": "",
  "registrationActId": 196,
  "memberSizeRangeId": 13,
  "memberSizeRangeValue": "100-1000",
  "currentMemberCount": 0,
  "members": [
    {
      "userId": 0,
      "firstName": "Tarun",
      "lastName": "Kumar",
      "middleName": "",
      "phonecode": "+91",
      "phoneCountryId": 1,
      "phoneNumber": 0,
      "emailId": "tarunkumar@gmail.com",
      "gender": "",
      "profilePicUrl": "",
      "associationMemberId": 0,
      "systemRoleId": 0,
      "systemRole": "",
      "statusId": 0,
      "status": "",
      "updatedDate": "2024-06-29T10:02:27.873Z",
      "registrationNumber": ""
    }
  ],
  "referralCode": "",
  "about": "The Addidas welfare Foundation has evolved and adapted to changing times over the last two decades,",
  "geolocation": {
    "x": 15.5622086,
    "y": 73.74929399999999
  },
  "registrationActName": "",
  "chapterTypeId": 162,
  "chapterType": ""
}
/* Go is statically typed. A type defines the set of values and the set of operations that can take place on those valies. */

// Elementary or primitive types: int, float, bool, string.

// Structured or composite types: struct, array, slice, map, channel.

// Interfaces describe the behavior of a type.

/* We can create a user defined data type. It's also possible to have an alias for data types. An alias for int for example could be declared like so: */

type IZ int

// Then, to declar an integer variable, we have to use an alias like so:

var a IZ = 5

// To define more tha one type we can do it like so:

type (
	IZ int
	FZ float32
  	STR string
)

/* We can convert a value into another type of value through type-casting. However, Go does not allow implicit conversion, which means that Go never does such a conversion by itself. The conversion must be done explicitly as valueOfTypeB = typeB(valuePFTypeA). For example: */

package main
import "fmt"

func main(){
    var number float32 = 5.2         // Declared a floating point variable
    fmt.Println(number)              // Printing the value of variable
    fmt.Println(int(number))         // Printing the type-casted result
int power (int a, int b) {
  if (b==0)
    return 1;
  if (b==1)
    return a;
  int ans = power(a,b/2);
  if (b%2==0)
    return ans*ans;
  else
    return a*ans*ans;
}
//PaymentsClassDemo L12

//Cancel Component
//HTML
<h1>Cancelled</h1>
<p>Not sure you want to buy?;<br /> we'll preserve your cart until you're ready!</p>
//TS
import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-cancel',
  templateUrl: './cancel.component.html',
  styleUrls: ['./cancel.component.css']
})
export class CancelComponent implements OnInit {

  constructor() { }

  ngOnInit(): void {
  }
}

//Cart Component
//HTML
<h2 class="my-5">Items in cart</h2>

<div class="container products-container">
    <table class="table">
        <thead class="table-dark">
            <tr>
                <th scope="col">Subscription</th>
                <th scope="col">Price</th>
                <th scope="col">Quantity</th>
                <th scope="col">Total Cost</th>
            </tr>
        </thead>


        <tbody class="table-body">
            <tr *ngFor="let cartSub of subscriptionsInCart">
                <td>{{cartSub.subscription.name}}</td>
                <td>{{cartSub.subscription.price}}</td>
                <td>
                    <span class="increase" style="color:#89cff0">
                        <i class="fa-solid fa-circle-left fa-lg" (click)="reduceProdCount(cartSub.subscription)"></i>
                    </span>
                    {{cartSub.quantity}}
                    <span class="decrease" style="color:#89cff0">
                        <i class="fa-solid fa-circle-right fa-lg" (click)="increaseProdCount(cartSub.subscription)"></i>
                    </span></td>
                <td>{{cartSub.totalCost}}</td>
            </tr>
        </tbody>

        <tfoot class="table-footer">
            <tr>
                <td></td>
                <td></td>
                <td><b>Total:</b></td>
                <td>{{totalCostOfSubcriptionsInCart}}</td>
            </tr>
        </tfoot>

    </table>

    <br>

    <app-payfastcheckout></app-payfastcheckout>
</div>
//TS
import { Component, OnInit } from '@angular/core';
import { SubscriptionCartOrganiserService } from '../services/SubscriptionCartOrganiser.service';
import { CartSubScription } from '../models/CartSubscriptionVM.model';
import { Subscription } from '../models/Subscription.model';

@Component({
  selector: 'app-cart',
  templateUrl: './cart.component.html',
  styleUrls: ['./cart.component.css']
})
export class CartComponent implements OnInit {
  subscriptionsInCart : CartSubScription [] = [];
  totalCostOfSubcriptionsInCart :number = 0;

  constructor(private cartManager : SubscriptionCartOrganiserService) {
    this.loadSubscriptions();
    cartManager.cartProductsNumberDS.subscribe(num => {
        this.loadSubscriptions();
    });
  }

  ngOnInit(): void {
  }

  loadSubscriptions() {
    this.subscriptionsInCart = this.cartManager.getSubscriptionsInCart();
    this.totalCostOfSubcriptionsInCart = this.cartManager.getTotalCostOfSubcriptionsInCart();
  }

  increaseProdCount (sub : Subscription) {
    for (var idx = 0; idx < this.subscriptionsInCart.length; idx++) {
      if (this.subscriptionsInCart[idx].subscription.id == sub.id) {
        this.cartManager.addProdFromCart(this.subscriptionsInCart[idx].subscription);
      }
    }
  }

  reduceProdCount (sub : Subscription) {
    for (var idx = 0; idx < this.subscriptionsInCart.length; idx++) {
      if (this.subscriptionsInCart[idx].subscription.id == sub.id) {
         this.cartManager.removeProdFromCart(this.subscriptionsInCart[idx].subscription);
      }
    }
  }
}

//Models
//CartSubscriptionVM.model.ts
import { Subscription } from "./Subscription.model";

export class CartSubScription {
    subscription : Subscription;
    quantity : number = 1;
    totalCost : number = 0;

    constructor(subscr : Subscription, quant: number) {
        this.subscription = subscr;
        this.quantity = quant;
        this.totalCost = quant * subscr.price;
    }

    increment() {
        this.quantity +=1
    }
}

//Subscription.model.ts
export class Subscription {
    id : number = 0;
    name : string = "";
    description : string = "";
    price : number = 0;
}

//navigation-bar component
//HTML
<nav class="navbar navbar-expand-lg navbar-light bg-light">
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>

  <div class="collapse navbar-collapse" id="navbarSupportedContent">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item active">
        <a class="nav-link" routerLink="">Home <span class="sr-only">(current)</span></a>
      </li>
    </ul>
    <a class="navbar-brand" routerLink="cart">
        <span class="itemCount">{{numCartItems}}</span>
        <i class="fa-solid fa-cart-shopping"></i>
      </a>
  </div>
</nav>
//TS
import { Component, OnInit } from '@angular/core';
import { SubscriptionCartOrganiserService } from '../services/SubscriptionCartOrganiser.service';

@Component({
  selector: 'app-navigation-bar',
  templateUrl: './navigation-bar.component.html',
  styleUrls: ['./navigation-bar.component.css']
})
export class NavigationBarComponent implements OnInit {

  numCartItems : number = 0;
  constructor(private cartManager : SubscriptionCartOrganiserService) {
    this.numCartItems = cartManager.getNumberOfItemsInCart();
    
    cartManager.cartProductsNumberDS.subscribe(num => {
      this.numCartItems = num;
    });
   }

  ngOnInit(): void {
  }
}

//payfastcheckout component
//HTML
<button type="button" class="btn btn-primary m-3" (click)="doOnSitePayment()">Checkout</button>
//TS
import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Router } from '@angular/router';
import { SubscriptionCartOrganiserService } from '../services/SubscriptionCartOrganiser.service';
import { Md5 } from 'ts-md5';
import { FormBuilder } from '@angular/forms'
import { environment } from 'src/environments/environment';
declare function payfast_do_onsite_payment(param1 : any, callback: any): any;

@Component({
  selector: 'app-payfastcheckout',
  templateUrl: './payfastcheckout.component.html',
  styleUrls: ['./payfastcheckout.component.css']
})
export class PayfastcheckoutComponent implements OnInit {

  constructor(private httpComms : HttpClient, private pageRouter : Router, private cartManager : SubscriptionCartOrganiserService, private formBuilder: FormBuilder) {
    
  }

  ngOnInit(): void {

  }

  getSignature(data : Map<string, string>) : string {
    let tmp = new URLSearchParams();
    data.forEach((v, k)=> {
      tmp.append(k, v)
    });
    let queryString = tmp.toString();
    let sig = Md5.hashStr(queryString);
    return sig;
  }

  async doOnSitePayment() {
    let onSiteUserData = new Map<string, string>();
    onSiteUserData.set("merchant_id", "10033427")
    onSiteUserData.set("merchant_key", "mu83ipbgas9p7")

    onSiteUserData.set('return_url', window.location.origin + '/success')
    onSiteUserData.set('cancel_url', window.location.origin + '/cancel')

    onSiteUserData.set("email_address", 'test@user.com');
    
    onSiteUserData.set("amount", this.cartManager.getTotalCostOfSubcriptionsInCart().toString());
    onSiteUserData.set("item_name", this.cartManager.getCartOrderName());

    onSiteUserData.set('passphrase', 'HelloWorldHello');

    let signature = this.getSignature(onSiteUserData);
    onSiteUserData.set('signature', signature);


    let formData = new FormData();
    onSiteUserData.forEach((val, key) => {
      formData.append(key, val);
    }); 
    
    let response = await fetch(environment.payfastOnsiteEndpoint, {
      method: 'POST',
      body: formData,
      redirect: 'follow'
    });
    
    let respJson = await response.json();
    let uuid = respJson['uuid'];
    payfast_do_onsite_payment({'uuid': uuid},  (res: any) => {
      if (res == true) {
        this.pageRouter.navigate(['/success'])
      }
      else {
        this.pageRouter.navigate(['/cancel'])
      }
    });
  }

  doFormPayment() {
    let onSiteUserData = new Map<string, string>();
    onSiteUserData.set("merchant_id", "10033427")
    onSiteUserData.set("merchant_key", "mu83ipbgas9p7")

    onSiteUserData.set('return_url', window.location.origin + '/success')
    onSiteUserData.set('cancel_url', window.location.origin + '/cancel')

    onSiteUserData.set("email_address", 'test@user.com');
    
    onSiteUserData.set("amount", this.cartManager.getTotalCostOfSubcriptionsInCart().toString());
    onSiteUserData.set("item_name", this.cartManager.getCartOrderName());

    onSiteUserData.set('passphrase', 'HelloWorldHello');

    let signature = this.getSignature(onSiteUserData);
    onSiteUserData.set('signature', signature);

    let autoPaymentForm = this.formBuilder.group(onSiteUserData);
    
    this.httpComms.post('https://sandbox.payfast.co.za/eng/process', onSiteUserData).subscribe(resp => {
      console.log(resp);
    });
  }

}

//productcatalog component
//HTML
<div class="row mt-5">
        <div class="card m-3" style="width: 20rem;" *ngFor="let prod of products">
            <div class="card-body">
                <h5 class="card-title">{{prod.name}}</h5>
                <p class="card-text">
                    {{prod.description}}
                </p>
                <button type="button" class="btn btn-primary" (click)="addSubscriptionToCart(prod)">
                    Add to cart
                </button>
            </div>
        </div>
</div>

<div aria-live="polite" aria-atomic="true" style="position: relative; min-height: 200px;">
    <div class="toast" style="position: absolute; top: 0; right: 0;">
      <div class="toast-header">
        <img src="..." class="rounded mr-2" alt="...">
        <strong class="mr-auto">Cart items</strong>
        <small>Now</small>
        <button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="toast-body">
        Added item to cart.
      </div>
    </div>
  </div>
//TS
import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';
import { Subscription } from '../models/Subscription.model';
import { FakeSubscriptionDataService } from '../services/FakeSubscriptionData.service';
import { SubscriptionCartOrganiserService } from '../services/SubscriptionCartOrganiser.service';

@Component({
  selector: 'app-productcatalog',
  templateUrl: './productcatalog.component.html',
  styleUrls: ['./productcatalog.component.css']
})
export class ProductcatalogComponent implements OnInit {

  products : Subscription [] = [];

  constructor(private fakeDataProvider : FakeSubscriptionDataService, private cartSubscriptionService : SubscriptionCartOrganiserService) {
    this.products = fakeDataProvider.getOfferedSubscriptions();
  }

  ngOnInit(): void {
  }

  addSubscriptionToCart(product : Subscription) {
    this.cartSubscriptionService.addProdFromCart(product);
  }

}

//Services
//FakeSubscriptionData.service.ts
import { Injectable } from "@angular/core";
import { Subscription } from "../models/Subscription.model";

@Injectable({
    providedIn: 'root'
})
export class FakeSubscriptionDataService {
    subscriptions : Subscription[];

    constructor () {
        this.subscriptions = [
            {
              id: 1,
              name: "Netflix",
              description:  "At Netflix, we want to entertain the world. Whatever your taste, and no matter where you live, we give you access to best-in-class TV series, documentaries, feature films and mobile games.",
              price : 100
            },
            {
              id: 2,
              name: "Showmax",
              description: "Showmax is an internet TV service. What sets Showmax apart is a unique combination of hit African content, first and exclusive international series, movies, the best kids’ shows, and live sport.",
              price : 500
            },
            {
              id: 3,
              name: "Tencent Video",
              description: "Tencent Video is China's second-largest video-streaming platform. It includes a variety of categories of online videos. The most popular categories on the platform include Chinese TV shows  and China-made animation shows.",
              price : 800
            },
            {
              id: 4,
              name: "BBC iPlayer",
              description: "BBC iPlayer is a video on demand service from the BBC. The service is available on a wide range of devices, including mobile phones and tablets, personal computers and smart televisions.",
              price : 900
            },
          ];
    }

    getOfferedSubscriptions () {
        return this.subscriptions;
    }
}

//SubscriptionCartOrganiser.service.ts
import { Injectable } from "@angular/core";
import { Subject } from "rxjs";
import { CartSubScription } from "../models/CartSubscriptionVM.model";
import { Subscription } from "../models/Subscription.model";

@Injectable({
    providedIn: 'root'
})
export class SubscriptionCartOrganiserService {
    static tmpSubscriptionsCartName : string = "ls-cart-subscriptions";
    cartProductsNumberDS = new Subject<number>();
    cartItemsOrderName : string = "Subs Order @ ";

    notifyOnNewItemInCart() {
        this.cartProductsNumberDS.next(this.getNumberOfItemsInCart());
    }

    getLocalStorageSubscriptions(): Subscription[] {
        let storedSubString = localStorage.getItem(SubscriptionCartOrganiserService.tmpSubscriptionsCartName)
        let cartSubscriptions = [];
        if (storedSubString) {
          cartSubscriptions = JSON.parse(storedSubString)
        }
        return cartSubscriptions;
    }
    getNumberOfItemsInCart() : number {
        return this.getLocalStorageSubscriptions().length
    }

    getSubscriptionsInCart() : CartSubScription[] {
        let localStorageSubs = this.getLocalStorageSubscriptions();
        let cartSubscriptions : CartSubScription[] = [];

        let subCounts = new Map<Number, Number>(); //temporary storage
        localStorageSubs.forEach(sub => {
            if (!subCounts.has(sub.id)) {
                let count = localStorageSubs.filter(currSub => currSub.id == sub.id).length;
                subCounts.set(sub.id, count)
                let cartSub = new CartSubScription(sub, count);
                cartSubscriptions.push(cartSub);
            }
        });
        return cartSubscriptions;
    }

    getTotalCostOfSubcriptionsInCart() : number {
        let totalCost = 0;
        
        let cartSubs = this.getSubscriptionsInCart();
        cartSubs.forEach(cartSub => {
            totalCost += (cartSub.subscription.price * cartSub.quantity);
        });

        return totalCost;
    }

    getCartOrderName() {
        return this.cartItemsOrderName + Date.now();
    }

    addSubscriptionToCart(product : Subscription) {
        let storedSubString = localStorage.getItem(SubscriptionCartOrganiserService.tmpSubscriptionsCartName)
    
        let cartSubscriptions = [];
        if (storedSubString) {
          cartSubscriptions = JSON.parse(storedSubString)
        }
        cartSubscriptions.push(product);
        localStorage.setItem(SubscriptionCartOrganiserService.tmpSubscriptionsCartName, JSON.stringify(cartSubscriptions))
    
        this.notifyOnNewItemInCart();
      }
    

    removeProdFromCart(subscr : Subscription) {
        let storedSubString = localStorage.getItem(SubscriptionCartOrganiserService.tmpSubscriptionsCartName)
    
        let cartSubscriptions = [];
        if (storedSubString) {
          cartSubscriptions = JSON.parse(storedSubString)
        }
        for (var idx = 0; idx < cartSubscriptions.length; idx++) {
            if (cartSubscriptions[idx].id == subscr.id) {
                cartSubscriptions.splice(idx, 1);
                break;
            }
        }

        localStorage.setItem(SubscriptionCartOrganiserService.tmpSubscriptionsCartName, JSON.stringify(cartSubscriptions))

        this.notifyOnNewItemInCart();
    }

    addProdFromCart(subscr : Subscription) {
        this.addSubscriptionToCart(subscr);
        this.notifyOnNewItemInCart();   
    }

    clearCart () {
        localStorage.removeItem(SubscriptionCartOrganiserService.tmpSubscriptionsCartName);
        this.notifyOnNewItemInCart();
    }
}

//Success component
//HTML
<h1>Success</h1>
<p>We received your purchase;<br /> Your items will be sent shortly!</p>
//TS
import { Component, OnInit } from '@angular/core';
import { SubscriptionCartOrganiserService } from '../services/SubscriptionCartOrganiser.service';

@Component({
  selector: 'app-success',
  templateUrl: './success.component.html',
  styleUrls: ['./success.component.css']
})
export class SuccessComponent implements OnInit {

  constructor(private cartManager : SubscriptionCartOrganiserService) {

  }

  ngOnInit(): void {
    this.cartManager.clearCart();
  }

}

//app component
//app-routing.module.ts
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { CancelComponent } from './cancel/cancel.component';
import { CartComponent } from './cart/cart.component';
import { ProductcatalogComponent } from './productcatalog/productcatalog.component';
import { SuccessComponent } from './success/success.component';

const routes: Routes = [
  {path : '', component: ProductcatalogComponent},
  {path : 'cart', component: CartComponent},
  {path : 'success', component: SuccessComponent},
  {path: 'cancel', component: CancelComponent}
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }

//app.component.html
<app-navigation-bar></app-navigation-bar>
<div class="container mt-1">
<router-outlet></router-outlet>
</div>

//app.component.ts
import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'PaymentsClassDemo';
}

//app.module.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { SquarecheckoutComponent } from './squarecheckout/squarecheckout.component';
import { PayfastcheckoutComponent } from './payfastcheckout/payfastcheckout.component';
import { ProductcatalogComponent } from './productcatalog/productcatalog.component';
import { CartComponent } from './cart/cart.component';
import { NavigationBarComponent } from './navigation-bar/navigation-bar.component';
import { HttpClientModule } from '@angular/common/http';
import { SuccessComponent } from './success/success.component';
import { CancelComponent } from './cancel/cancel.component'
import { FormsModule, ReactiveFormsModule } from '@angular/forms';

@NgModule({
  declarations: [
    AppComponent,
    SquarecheckoutComponent,
    PayfastcheckoutComponent,
    ProductcatalogComponent,
    CartComponent,
    NavigationBarComponent,
    SuccessComponent,
    CancelComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    HttpClientModule,
    FormsModule, ReactiveFormsModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

//environment
//environment.prod.ts
export const environment = {
  production: true,
  payfastEndpoint: 'https://www.payfast.co.za/en/process',
  payfastOnsiteEndpoint: 'https://www.payfast.co.za/onsite/​process',
};

//environment.ts
export const environment = {
  production: false,
  payfastEndpoint: 'https://sandbox.payfast.co.za/eng/process',
  payfastOnsiteEndpoint: 'https://sandbox.payfast.co.za/onsite/process'
};
selector .swiper-slide {
  box-shadow: 10px 10px 10px  #00000009;
bool binarySearch(int arr[], int s, int e, int key) {
  if (s > e)
    return false;
  int mid = s + (e - s) / 2;
  if (arr[mid] == key)
    return true;
  if (arr[mid] < key)
    return binarySearch(arr, mid + 1, e, key);
  else
    return binarySearch(arr, s, mid - 1, key);
}
star

Tue Jul 02 2024 09:58:34 GMT+0000 (Coordinated Universal Time) https://justpaste.it/incest_wanker

@kingtribe201

star

Tue Jul 02 2024 09:57:59 GMT+0000 (Coordinated Universal Time) https://justpaste.it/nursery4fun

@kingtribe201

star

Tue Jul 02 2024 09:46:26 GMT+0000 (Coordinated Universal Time) https://justpaste.it/SexyOutfit

@kingtribe201

star

Tue Jul 02 2024 09:46:19 GMT+0000 (Coordinated Universal Time) https://justpaste.it/SexyOutfit

@kingtribe201

star

Tue Jul 02 2024 09:07:35 GMT+0000 (Coordinated Universal Time)

@Ranjith

star

Tue Jul 02 2024 07:20:02 GMT+0000 (Coordinated Universal Time)

@quanganh141220 #php #single #product

star

Tue Jul 02 2024 06:59:16 GMT+0000 (Coordinated Universal Time)

@niavimi

star

Tue Jul 02 2024 06:53:59 GMT+0000 (Coordinated Universal Time)

@shivam1234

star

Tue Jul 02 2024 04:28:19 GMT+0000 (Coordinated Universal Time)

@davidmchale #events #event #addeventlistener #removelistener

star

Tue Jul 02 2024 03:28:51 GMT+0000 (Coordinated Universal Time)

@davidmchale #dom #scroll #scrollintoview

star

Tue Jul 02 2024 01:27:00 GMT+0000 (Coordinated Universal Time)

@davidmchale #dom #css #inline #getcomputedstyle

star

Tue Jul 02 2024 01:12:22 GMT+0000 (Coordinated Universal Time)

@FOrestNAtion

star

Tue Jul 02 2024 00:50:37 GMT+0000 (Coordinated Universal Time)

@nouhad #mel

star

Tue Jul 02 2024 00:50:05 GMT+0000 (Coordinated Universal Time)

@nouhad #mel

star

Tue Jul 02 2024 00:49:28 GMT+0000 (Coordinated Universal Time)

@nouhad #mel

star

Tue Jul 02 2024 00:48:42 GMT+0000 (Coordinated Universal Time)

@nouhad #mel

star

Tue Jul 02 2024 00:48:00 GMT+0000 (Coordinated Universal Time)

@nouhad #mel

star

Tue Jul 02 2024 00:40:54 GMT+0000 (Coordinated Universal Time)

@nouhad #mel

star

Tue Jul 02 2024 00:40:26 GMT+0000 (Coordinated Universal Time)

@nouhad #mel

star

Tue Jul 02 2024 00:39:37 GMT+0000 (Coordinated Universal Time)

@nouhad #mel

star

Tue Jul 02 2024 00:38:58 GMT+0000 (Coordinated Universal Time)

@nouhad #mel

star

Tue Jul 02 2024 00:38:26 GMT+0000 (Coordinated Universal Time)

@nouhad #mel

star

Tue Jul 02 2024 00:37:32 GMT+0000 (Coordinated Universal Time)

@nouhad #mel

star

Tue Jul 02 2024 00:27:32 GMT+0000 (Coordinated Universal Time)

@nouhad #mel

star

Tue Jul 02 2024 00:26:38 GMT+0000 (Coordinated Universal Time)

@nouhad #mel

star

Tue Jul 02 2024 00:25:35 GMT+0000 (Coordinated Universal Time)

@nouhad #mel

star

Tue Jul 02 2024 00:22:59 GMT+0000 (Coordinated Universal Time)

@nouhad #mel

star

Tue Jul 02 2024 00:22:06 GMT+0000 (Coordinated Universal Time)

@nouhad #mel

star

Tue Jul 02 2024 00:20:55 GMT+0000 (Coordinated Universal Time)

@nouhad #mel

star

Tue Jul 02 2024 00:19:55 GMT+0000 (Coordinated Universal Time)

@nouhad #mel

star

Mon Jul 01 2024 23:11:34 GMT+0000 (Coordinated Universal Time)

@iamkatmakhafola

star

Mon Jul 01 2024 15:36:49 GMT+0000 (Coordinated Universal Time)

@sandipsable

star

Mon Jul 01 2024 13:05:50 GMT+0000 (Coordinated Universal Time) https://maticz.com/on-demand-app-development

@jamielucas #drupal

star

Mon Jul 01 2024 12:25:09 GMT+0000 (Coordinated Universal Time)

@Ranjith

star

Mon Jul 01 2024 11:59:35 GMT+0000 (Coordinated Universal Time)

@Ranjith

star

Mon Jul 01 2024 11:30:49 GMT+0000 (Coordinated Universal Time) https://www.regular-expressions.info/

@NoFox420 #javascript

star

Mon Jul 01 2024 11:00:29 GMT+0000 (Coordinated Universal Time)

@iamkatmakhafola

star

Mon Jul 01 2024 10:45:12 GMT+0000 (Coordinated Universal Time)

@manhmd #java

star

Mon Jul 01 2024 10:13:22 GMT+0000 (Coordinated Universal Time)

@mrakchaudhary

star

Mon Jul 01 2024 06:50:08 GMT+0000 (Coordinated Universal Time) http://127.0.0.1:5500/roadmap.pdf

@ozzy2410

star

Mon Jul 01 2024 04:46:03 GMT+0000 (Coordinated Universal Time)

@alamin005 #javascript

star

Mon Jul 01 2024 03:55:18 GMT+0000 (Coordinated Universal Time)

@Ranjith

star

Sun Jun 30 2024 21:48:59 GMT+0000 (Coordinated Universal Time)

@pag0dy #go

star

Sun Jun 30 2024 18:13:52 GMT+0000 (Coordinated Universal Time) https://alinezhad.info/

@hcde156

star

Sun Jun 30 2024 12:12:51 GMT+0000 (Coordinated Universal Time)

@vishnu_jha #c++ #dsa #recursion #math

star

Sun Jun 30 2024 12:09:26 GMT+0000 (Coordinated Universal Time)

@iamkatmakhafola

star

Sun Jun 30 2024 10:44:10 GMT+0000 (Coordinated Universal Time)

@odesign

star

Sun Jun 30 2024 09:06:00 GMT+0000 (Coordinated Universal Time)

@vishnu_jha #c++ #dsa #recursion #array #binarysearch

Save snippets that work with our extensions

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