Skip to content

Instantly share code, notes, and snippets.

success: function(response) {
// added portion starts here
let requredResponse = response.slice(response.length - 12);
// added portion ends here
if (requredResponse == "Message sent") { // change response to required response
$(".form-message").html(
"Your message has been submitted successfully"
);
<?php
// Import PHPMailer classes into the global namespace
// These must be at the top of your script, not inside a function
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
// Load Composer's autoloader
require 'vendor/autoload.php';
$mail->Host = "smtp.gmail.com"; // SMTP server example
$mail->SMTPDebug = 0; // enables SMTP debug information (for testing)
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Port = 587; // set the SMTP port for the GMAIL server
$mail->Username = 'pixelcreatives231@gmail.com'; // SMTP username
$mail->Password = 'pixelcre@tives123'; // SMTP account password example
$mail->setFrom($email, $name);
const initialState = [
{
id: 0,
question: "Who is your favourite youtuber?",
options: [
{
id: 0,
option: "Casey Neistat",
},
{
export const addToCart = productId => (dispatch, getState) => {
// body here
}
// equivalent
function addToCart(productId) {
(dispatch,getState) => {
// body here
}
}
function makeRequest(location) {
return new Promise((resolve, reject) => {
console.log("making request to " + location);
if(location === "Google") {
resolve('Google says Hi');
} else {
reject('We only talk to Google');
}
const phoneNumberPattern = new RegExp("/^98[0,1,4,5,6]{1}[0-9]{7}$/");
const phoneNumberResult = phoneNumberPattern.test('9860922044');
console.log(phoneNumberResult);
let obj = {
bloodGroup:'A+',
coordinate: [12, 32]
}
let encodedBloodGroup = encodeURI(obj.bloodGroup);
let encodedLocation = encodeURI(obj.coordinate);
@JustAyush
JustAyush / queue.js
Created April 4, 2020 04:56
Queue Implementation in JavaScript
class Node {
constructor(value) {
this.value = value;
this.next = null;
}
}
class Queue {
@JustAyush
JustAyush / trie.js
Created April 4, 2020 04:17
Trie Implementation in Javascript
class TrieNode {
constructor(key) {
this.key = key;
this.parent = null;
this.children = {};
this.end = false;
}
// for finding out word from leaf to root of trie