Skip to content

Instantly share code, notes, and snippets.

View Faizanq's full-sized avatar

Faizan Qureshi Faizanq

View GitHub Profile
module.exports.generatePdf = async ()=>{
async function Html() {
try {
const data = {
name: 'Faizan'
}
https://myaccount.google.com/lesssecureapps
https://accounts.google.com/b/0/DisplayUnlockCaptcha
@Faizanq
Faizanq / gist:7e7a5d7ca320a3d6cfaad51f221b392c
Created September 27, 2019 03:18
Alter and Add new fields in Laravel Migration
php artisan make:migration alter_braintree_to_subscriptions --table=subscriptions
php artisan make:migration add_stripe_id_to_users --table=users
@Faizanq
Faizanq / ID.js
Created June 12, 2020 08:26
ID - a unique ID/name generator for JavaScript
// Generate unique IDs for use as pseudo-private/protected names.
// Similar in concept to
// <http://wiki.ecmascript.org/doku.php?id=strawman:names>.
//
// The goals of this function are twofold:
//
// * Provide a way to generate a string guaranteed to be unique when compared
// to other strings generated by this function.
// * Make the string complex enough that it is highly unlikely to be
// accidentally duplicated by hand (this is key if you're using `ID`
@Faizanq
Faizanq / settimeout.php
Created July 9, 2020 10:12 — forked from edwjusti/settimeout.php
setTimeout for php
<?php
class TimeoutClass extends Thread {
public function __construct(callable $cb, int $time, $args){
$this->callback = $cb;
$this->args = $args;
$this->time = $time * 1000;
}
public function run(){
usleep($this->time);
# 7.4
sudo apt-get -y install php-pear php7.4-dev
sudo update-alternatives --set php /usr/bin/php7.4
sudo update-alternatives --set phar /usr/bin/phar7.4
sudo update-alternatives --set phar.phar /usr/bin/phar.phar7.4
sudo update-alternatives --set phpize /usr/bin/phpize7.4
sudo update-alternatives --set php-config /usr/bin/php-config7.4
sudo pecl uninstall -r sqlsrv
<template>
<div class="widget">
<div v-if="activeItems && activeItems.length > 0">
<ul>
<li v-for="item in activeItems" :key="item.id">
{{item.name}}
</li>
</ul>
</div>
</div>
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class NewCustomerRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
This is the request validadtion code for post route
https://gist.github.com/Faizanq/3d2b435b7c61fa37f28feb74ddef2daa
Customer Controller Code
https://gist.github.com/Faizanq/f7096495a66080e15c31d6ea55e98b7a
Customer mail observer which is responsible for mail sending
https://gist.github.com/Faizanq/60fd21b3f4c4ee71876fbe2429d5295d
Customer model where we injecting observer for create event
<?php
namespace App\Http\Controllers;
use App\Models\Customer;
use App\Http\Requests\NewCustomerRequest;
class CustomerController extends Controller