Skip to content

Instantly share code, notes, and snippets.

View WatheqAlshowaiter's full-sized avatar

Watheq Alshowaiter WatheqAlshowaiter

View GitHub Profile
@lukeraymonddowning
lukeraymonddowning / example.php
Created August 20, 2024 12:12
Shows how to mock actions easily for testing in Laravel
public function shouldHaveReceivedAction(string $action)
{
$original = $this->app->make($action);
$this->mock($original)
->shouldReceive('handle')
->atLeast()->once()
->andReturnUsing(fn (...$args) => $original->handle(...$args));
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
@muath-ye
muath-ye / BragDoc.md
Last active June 1, 2023 09:20
@WatheqAlshowaiter template for brag document

Brag document / weekly professional journal

Note: I advice you to write every thursday (at the end of the workday week)

week 23 (4 June, 2023)

Courses

<?php
function memoize($target) {
static $memo = new WeakMap;
return new class ($target, $memo) {
function __construct(
protected $target,
protected &$memo,
) {}
@ammardev
ammardev / deployment.yml
Last active January 14, 2023 21:30
مثال بسيط Github Actions + Laravel Envoy
name: Deployment
run-name: Deployment
on:
push:
branches:
- 'master' # انا مهتم بالرفع فقط عند دمج أي شيء على الفرع الرئيسي
jobs:
stage:
runs-on: ubuntu-latest
#!/usr/bin/python
# -*- coding=utf-8 -*-
"""
An example of cleaning arabic text with PyArbic Library
Requirements: pip install pyarabic
Data: text file
Ouput: text file ( cleaned)
"""
import sys
@xiCO2k
xiCO2k / view.blade.php
Created October 13, 2022 17:11
Infinite Image fadeIn fadeOut
<div
class="relative pointer-events-none"
x-data="{ active: 0 }"
x-init="setInterval(() =>
active = ++active > $el.childElementCount - 1 ? 0 : active
, 3000)"
>
@foreach([
'hero-pic1.webp',
'hero-pic2.webp',
@m-alghobary
m-alghobary / AppServiceProvider.php
Created August 29, 2022 05:46
A Laravel macro that adds a 'sync' method to the 'HasMany' relationship similar to the one on the 'BelongsTo' relationship.
<?php
namespace App\Providers;
use Illuminate\Support\Arr;
use Illuminate\Support\ServiceProvider;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Relations\HasMany;
class AppServiceProvider extends ServiceProvider
@imAbdelhadi
imAbdelhadi / Linkedin learning subtitle translation to Arabic.js
Last active November 8, 2022 19:35
LinkedIn Learning ترجمة دورات لينكدإن ليرننج إلى اللغة العربية آليا
// طريقة التشغيل من موقعي على الرابط التالي: blog.abdelhadi.org
// ==UserScript==
// @name LinkedIn Learning ترجمة لينكدإن ليرننج
// @description LinkedIn Learning ترجمة دورات لينكدإن ليرننج إلى اللغة العربية
// @namespace https://github.com/journey-ad
// @version 0.2.1
// @icon https://static.licdn.cn/sc/h/2c0s1jfqrqv9hg4v0a7zm89oa
// @author journey-ad
// @match *://www.linkedin.com/learning/*
// @require https://greasyfork.org/scripts/411512-gm-createmenu/code/GM_createMenu.js?version=864854
@valorin
valorin / .env.example
Last active December 24, 2024 18:18
CSP Middleware - the simple CSP middleware I use across all of my projects.
# Add to your .env.example and .env files
CSP_ENABLED=true
CSP_REPORT_ONLY=true