Skip to content

Instantly share code, notes, and snippets.

View alwaisy's full-sized avatar

Awais alwaisy alwaisy

View GitHub Profile

The issue here lies in the usage of event.preventDefault(). It should be placed at the beginning of the event handler and not within the submitHandler. The submitHandler is a method provided by the jQuery Validate plugin, not by jQuery's event system. In this case, you do not actually have direct access to the event object for the submit event, so calling event.preventDefault() will not work.

Here's how you can modify your code to correctly use event.preventDefault():

$(".commentForm").on('submit', function(event) {
    event.preventDefault();
    var form = $(this);
    if (!form.valid()) return; // You should add validation here

Some of my projects

GitHub -> https://gist.github.com/awaisalwaisy

1. ProxyScrape - Loopbrackets

(Business logic is implemented in standard way)

Skills: Vuex · TypeScript · Vue.js Responsibilities: There was a website stacked with traditional technologies like jQuery and PHP. My responsibility was to convert it into a

@alwaisy
alwaisy / article-topics.md
Created February 23, 2023 13:49
article-topics

Hi, this gist will be updated soon.

@alwaisy
alwaisy / awaisalwaisy-vue-projects.md
Last active July 10, 2023 09:57
Projects I have made in VueJs

Here is the list of my work in VueJs

Proxyscrape (client)

Main project I did in the last company. Requirements were to convert traditional php + jquery webiste to vuejs. I used

  1. Typescript
  2. Vue 3
  3. Vuex later pinia
  4. Webpack 4 later Vite
  5. SPA later ssr/nuxt
import React, { FormEvent } from "react";
import { SectionTitle } from "@shared";
import { Text } from "@atoms";
import { FormText } from "@cells";
import { Label } from "@molecules";
import styles from "./Contact.module.css";
import { FieldHint, FieldLabel, FormSubmit, FormTerms } from "./FormComponents";
import { radioFields, textFields } from "@/data";
import { useState } from "react";
@alwaisy
alwaisy / _spacing-helpers.scss
Created December 28, 2022 09:19 — forked from jacurtis/_spacing-helpers.scss
SASS Margin and Padding Helpers Loop. Generates .m-t-10 type helper classes.
/*
This .scss loop will create "margin helpers" and "padding helpers" for use in your web projects.
It will generate several classes such as:
.m-r-10 which gives margin-right 10 pixels.
.m-r-15 gives MARGIN to the RIGHT 15 pixels.
.m-t-15 gives MARGIN to the TOP 15 pixels and so on.
.p-b-5 gives PADDING to the BOTTOM of 5 pixels
.p-l-40 gives PADDING to the LEFT of 40 pixels
///// button-atom
add borderRadius: string to index.d.ts
add props borderRadius to button.tsx
add borderRadius: "10px" to default props
// issues:
color property is not working
// solution
remove color property from Button story Text component
add color="primary" props in button.tsx
/**
Objective
Today, we're working with Binary Search Trees (BSTs). Check out the Tutorial tab for learning materials and an instructional video!
Task
The height of a binary search tree is the number of edges between the tree's root and its furthest leaf. You are given a pointer, , pointing to the root of a binary search tree. Complete the getHeight function provided in your editor so that it returns the height of the binary search tree.
Input Format
The locked stub code in your editor reads the following inputs and assembles them into a binary search tree:
/**
Today we're discussing Generics; be aware that not all languages support this construct, so fewer languages are enabled for this challenge. Check out the Tutorial tab for learning materials and an instructional video!
Task
Write a single generic function named printArray; this function must take an array of generic elements as a parameter (the exception to this is C++, which takes a vector). The locked Solution class in your editor tests your function.
Note: You must use generics to solve this challenge. Do not write overloaded functions.
Input Format
/**
Objective
Today, we're discussing a simple sorting algorithm called Bubble Sort. Check out the Tutorial tab for learning materials and an instructional video!
Consider the following version of Bubble Sort:
for (int i = 0; i < n; i++) {
// Track number of elements swapped during a single array traversal
int numberOfSwaps = 0;