Skip to content

Instantly share code, notes, and snippets.

View tararoutray's full-sized avatar

Tara Prasad Routray tararoutray

View GitHub Profile
// String.includes()
// The includes() method returns true if a string contains a specified value, otherwise false.
let message = "The movie is yet to begin!";
message.includes("begin"); // This will return true.
// String.startsWith()
// The startsWith() method returns true if a string begins with a specified value, otherwise false.
let message = "The movie is yet to begin!";
message.startsWith("The"); // This will return true.
// Array.from()
// The Array.from() method returns an Array object from any object with a length property or any iterable object.
// Following will return ["A", "I", "L", "J", "S", "I", "6", "4", "6", "8", "5"]
Array.from("AILJSI64685");
// Array.keys()
// The Array.keys() method returns an Array Iterator object with the keys of an array.
const fruits = ["Avocado", "Kiwi", "Apple", "Mango"];
// Array destructuring
// Initialize an array with sample data
const userDetails = ['Luis James', '24', '[email protected]'];
// Destructure the above array - extract the array elements to variables
const [username, age, email] = userDetails;
console.log(username); // This will print: Luis James
console.log(age); // This will print: 24
console.log(email); // This will print: [email protected]
// Import the HTTP module by using the require() method.
// The require() method is available globally
const http = require('http');
// Since we have imported the HTTP module,
// we can use methods from that module.
// Call the createServer() method inorder to create a server.
// This file contains the same code of the previous gist.
// with a little bit enhancement.
const http = require('http');
const server = http.createServer((request, response) => {
// The feature to handle the request and send back response
// starts from here.
# Name of the email driver or mailer
MAIL_MAILER=mailgun
# Mailer Host
MAIL_HOST=smtp.mailgun.org
# Mailer Port
MAIL_PORT=587
# Username
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class HelloEmail extends Mailable
<div class="container" style="padding: 1rem; background: #f5f5f5;">
<p>Good Morning XYZ!</p>
<p>
Welcome to Laravel. This is a demo of sending emails through
the Mailgun email service.
</p>
</div>
<?php
namespace App\Http\Controllers;
use App\Mail\HelloEmail;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;
class EmailController extends Controller
{
<?php
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|