Skip to content

Instantly share code, notes, and snippets.

View bhaidar's full-sized avatar

Bilal Haidar bhaidar

View GitHub Profile
@bhaidar
bhaidar / Composer.php
Created February 8, 2022 12:55 — forked from sam-ngu/Composer.php
Laravel helper class to run composer command programmatically.
<?php
namespace App;
class Composer extends \Illuminate\Support\Composer
{
public function run(array $command)
{
@bhaidar
bhaidar / index.php
Created February 16, 2022 08:28 — forked from PovilasKorop/index.php
PHP NumberFormatter Demo
<?php
function getFormattedNumber(
$value,
$locale = 'en_US',
$style = NumberFormatter::DECIMAL,
$precision = 2,
$groupingUsed = true,
$currencyCode = 'USD',
) {
@bhaidar
bhaidar / download_csv.php
Created August 26, 2022 08:36 — forked from mpijierro/download_csv.php
Example streaming large CSV files with Laravel and thousands of queries
<?php
namespace Src\Csv;
use Illuminate\Http\Response;
use Symfony\Component\HttpFoundation\StreamedResponse;
/**
* Class DownloadLargeCsv
*
@bhaidar
bhaidar / Response.php
Created December 19, 2022 11:29 — forked from jeffochoa/Response.php
Laravel HTTP status code
<?php
// This can be found in the Symfony\Component\HttpFoundation\Response class
const HTTP_CONTINUE = 100;
const HTTP_SWITCHING_PROTOCOLS = 101;
const HTTP_PROCESSING = 102; // RFC2518
const HTTP_OK = 200;
const HTTP_CREATED = 201;
const HTTP_ACCEPTED = 202;
@bhaidar
bhaidar / PieChartSvg.vue
Created January 17, 2023 22:00 — forked from marwinious/PieChartSvg.vue
SVG Pie Chart Component for Vue.js
/*
Initial concept from: https://seesparkbox.com/foundry/how_to_code_an_SVG_pie_chart
Vue.js component by Darius Babcock
*/
<template>
<div class="pie_chart_svg_container">
<svg
:height="diameter"
:width="diameter"
@bhaidar
bhaidar / GoogleDriveServiceProvider.php
Created January 29, 2023 22:38 — forked from sergomet/GoogleDriveServiceProvider.php
Setup a Laravel Storage driver with Google Drive API
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class GoogleDriveServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
@bhaidar
bhaidar / FilesystemMockProvider.php
Created February 19, 2023 19:42 — forked from stevebauman/FilesystemMockProvider.php
Filesystem Cloud Mocking
<?php
namespace App\Providers;
class FilesystemMockProvider extends ServiceProvider
{
public function boot()
{
if (App::isProduction()) {
return;
@bhaidar
bhaidar / helpers.php
Created February 19, 2023 20:56 — forked from JordanDalton/helpers.php
Pipeline Helper / Wrapper
<?php
if( ! function_exists('pipe')) {
function pipe($payload, $steps = [])
{
return app(\Illuminate\Pipeline\Pipeline::class)
->send($payload)
->through($steps)
@bhaidar
bhaidar / useSpeechRecognition.js
Created February 25, 2023 14:37
Speech Recognition Composable for Vue and Composable API
import { ref,watch,shallowRef,unref } from 'vue'
export function useSpeechRecognition({lang,continuous,interimResults}) {
const isListening = ref(false)
const isFinal = ref(false)
const result = ref('')
const error = shallowRef(undefined)
const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition