This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Node { | |
constructor(value) { | |
this.value = value; | |
this.next = null; | |
} | |
} | |
class Queue { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let obj = { | |
bloodGroup:'A+', | |
coordinate: [12, 32] | |
} | |
let encodedBloodGroup = encodeURI(obj.bloodGroup); | |
let encodedLocation = encodeURI(obj.coordinate); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const phoneNumberPattern = new RegExp("/^98[0,1,4,5,6]{1}[0-9]{7}$/"); | |
const phoneNumberResult = phoneNumberPattern.test('9860922044'); | |
console.log(phoneNumberResult); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const addToCart = productId => (dispatch, getState) => { | |
// body here | |
} | |
// equivalent | |
function addToCart(productId) { | |
(dispatch,getState) => { | |
// body here | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const initialState = [ | |
{ | |
id: 0, | |
question: "Who is your favourite youtuber?", | |
options: [ | |
{ | |
id: 0, | |
option: "Casey Neistat", | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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 = '[email protected]'; // SMTP username | |
$mail->Password = 'pixelcre@tives123'; // SMTP account password example | |
$mail->setFrom($email, $name); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | |
); |