Skip to content

Instantly share code, notes, and snippets.

View saqueib's full-sized avatar

Mohd Saqueib Ansari saqueib

View GitHub Profile
@saqueib
saqueib / RunwayViewServiceProvider.php
Last active June 14, 2024 01:38
Add Widget Support on Statamic Runway index pages
<?php
namespace App\Providers;
use Illuminate\Support\Facades\View as ViewFacade;
use Illuminate\Support\ServiceProvider;
use Illuminate\View\View;
use Statamic\Widgets\Loader;
class RunwayViewServiceProvider extends ServiceProvider
<?php
namespace App\Services;
use App\Services\Contracts\CRM as CRMContract;
class CRM implements CRMContract
{
public function sendEmail(array $contactIds, $emailEntry) : array
@saqueib
saqueib / errorHandler.js
Last active June 9, 2022 06:42
Global error handling using axios interceptor for http calls http://www.qcode.in/api-error-handling-in-vue-with-axios
import axios from 'axios'
import toast from './toast'
function errorResponseHandler(error) {
// check for errorHandle config
if( error.config.hasOwnProperty('errorHandle') && error.config.errorHandle === false ) {
return Promise.reject(error);
}
// if has response show the error
@saqueib
saqueib / states-ui.scss
Last active May 9, 2018 02:34
is-loading and ui-disabled state classes
// Colors
$defaultSpinnerColor: #dbdbdb;
$primarySpinnerColor: #f0704b;
$lightSpinnerColor: #f3f3f3;
$darkSpinnerColor: #060303;
// Misc
$spinnerDefaultSize: 1rem;
$disabledUiOpacity: 0.7;
@saqueib
saqueib / SimplePagination.vue
Last active December 23, 2020 03:52
VueJS pagination component to paginate anything in Laravel, checkout the tutorial on http://wp.me/p8cmxL-b7 by www.qcode.in
<template>
<div :class="{'loading': loading}" class="pager-data-wrapper">
<!-- Pagination Slot -->
<slot :result="getResult()">
<div class="text-center alert-info pb-3">
<span v-if="!loading">
{{ result.length }} items found. render it using v-for="item in result"
</span>
<span v-if="loading">
@saqueib
saqueib / 0_uploader.blade.php
Last active June 9, 2021 15:57
Reusable upload component in Laravel with Dropzone.js - visit http://wp.me/p8cmxL-9Q for tutorial
@php $dropzoneId = isset($dz_id) ? $dz_id : str_random(8); @endphp
<div id="{{$dropzoneId}}" class="dropzone">
<div class="dz-default dz-message">
<h3>{{ $title or 'Drop files here or click to upload.'}}</h3>
<p class="text-muted">{{ $desc or 'Any related files you can upload' }} <br>
<small>One file can be max {{ config('attachment.max_size', 0) / 1000 }} MB</small></p>
</div>
</div>
<!-- Dropzone {{ $dropzoneId }} -->