Skip to content

Instantly share code, notes, and snippets.

View abdumu's full-sized avatar
💭
are we even real? or just entities in a simulated environment ,,,

Abdulrahman ☕️ abdumu

💭
are we even real? or just entities in a simulated environment ,,,
View GitHub Profile
@abdumu
abdumu / maintanance.php
Last active October 19, 2017 17:54
Arabic maintenance page + htaccess redirect except your IP
<?php
#modifed version of https://gist.github.com/pitch-gist/2999707
//by twitter/abdu1m
#htaccess:
// RewriteCond %{REQUEST_URI} !/maintenance.php$
// RewriteCond %{HTTP:X-FORWARDED-FOR} !=151.254.68.111 #this is your ip
// RewriteRule $ /maintenance.php [R=302,L]
?>
<!doctype html>
@abdumu
abdumu / pipleline.php
Created November 25, 2017 03:08
How Laravel middleware system work
<?php
//the middleware
$middleware1 = function ($request, $carry) {
echo "first middleware \n";
return $carry($request);
};
@abdumu
abdumu / Collection.loop.php
Last active December 23, 2017 02:55
[Laravel] Improved version of Collection->map as a macro (you can add it at AppServiceProvider.php boot method)
<?php
/*
* Improved version of Collection->map method
*
* @param callable $callback
*
* @return Illuminate\Support\Collection
*/
Illuminate\Support\Collection::macro('loop', function(callable $callback){
@abdumu
abdumu / Laravel.Collection.drop.php
Created December 23, 2017 04:11
[Laravel] Drop first or last items from a collection
<?php
/**
* drop the first or last {$limit} items.
*
* @param int $limit
* @return Illuminate\Support\Collection
*/
Illuminate\Support\Collection::macro('drop', function(int $limit){
if ($limit < 0) {
return $this->slice(0, $limit);
@abdumu
abdumu / .post-merge
Created February 25, 2018 02:44
git hook (.git/hooks/.post-merge) to run a command after `git pull` for laravel by @Abdu1M
##
# git hook to run a command after `git pull` for laravel by @abdu1m
##
# source: https://gist.github.com/sindresorhus/7996717
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
}
<template>
<transition name="modal" v-if="toggled">
<div class="fixed z-50 pin-t pin-l w-full h-screen bg-grey overflow-y-scroll flex" style="background-color: rgba(0, 0, 0, .5);">
<div class="p-3 m-auto" :class="{'w-full': width!='auto'}">
<div id="modalBox" class="md:mx-auto p-4 md:p-8 bg-white border rounded border-grey-darkest shadow-lg" :class="{'w-full md:w-1/3':width === 'small', 'w-full md:w-5/6': width === 'large', 'inline-block': width === 'auto'}">
<div class="modal-header flex justify-center mb-2 text-center ">
<slot name="header"></slot>
</div>
@abdumu
abdumu / keybindings.json
Last active May 15, 2019 18:20
my vscode keybindings.json
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "cmd+enter",
"command": "editor.action.showContextMenu",
"when": "editorTextFocus"
},
{
"key": "shift+g",
"command": "workbench.view.scm"
@abdumu
abdumu / AppServiceProvider.php
Created June 29, 2019 16:04
production mix versioning ...
<?php
// ....
public function boot()
{
Blade::directive('mix', function ($path) {
if(! app()->environment('production')) {
return "<?=e(mix({$path}))?>";
}
@abdumu
abdumu / vbulletinValetDriver.php
Last active October 31, 2019 10:16
vbulletin laravel valet driver
<?php
class vbulletinValetDriver extends ValetDriver
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
@abdumu
abdumu / howTo.txt
Last active January 8, 2020 09:18
"This connection is not private" + "Valet" + "iOS Simulator"
-1- edit ~/.composer/vendor/laravel/valet/cli/stubs/openssl.conf
Change:
basicConstraints = CA:FALSE
To:
basicConstraints = CA:TRUE,pathlen:0
save file.