Skip to content

Instantly share code, notes, and snippets.

View bikramtuladhar's full-sized avatar
🎯
Focusing

Bikram Tuladhar bikramtuladhar

🎯
Focusing
View GitHub Profile
@bikramtuladhar
bikramtuladhar / docker-compose
Created December 15, 2021 17:44
docker-compose for arm
#!/bin/sh
#
# Run docker-compose in a container
#
# This script will attempt to mirror the host paths by using volumes for the
# following paths:
# * $(pwd)
# * $(dirname $COMPOSE_FILE) if it's set
# * $HOME if it's set
#
@bikramtuladhar
bikramtuladhar / user_table.blade.php
Created August 14, 2019 07:44
user table index page using eloquent route presenter
<table class="table table-striped">
<thead>
<tr>
<th>{{ trans('user.name') }}</th>
<th>{{ trans('user.email') }}</th>
<th>{{ trans('user.action') }}</th>
</tr>
</thead>
<tbody>
@foreach($users as $user)
@bikramtuladhar
bikramtuladhar / User.php
Last active August 14, 2019 07:36
Model with eloquent route presenter
<?php
namespace App;
use App\UrlPresenter\EloquentRoutePresenter;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
/**
* Class User
* @package App\User
@bikramtuladhar
bikramtuladhar / EloquentRoutePresenter.php
Last active August 14, 2019 05:57
Laravel Model with eloquent route presenter
<?php
namespace App\UrlPresenter;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Str;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
/**
* Trait EloquentRoutePresenter
* @package App\UrlPresenter
*/
trait EloquentRoutePresenter
@bikramtuladhar
bikramtuladhar / EloquentUrlPresenter.php
Last active August 14, 2019 07:31
Eloquent route presenter
<?php
namespace App\UrlPresenter;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Str;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
<?php
$multiply = function($a, $b) {
return $a * $b;
};
$addition = function($a, $b) {
return $a + $b;
};
@bikramtuladhar
bikramtuladhar / call_back_in_laravel_collection.php
Last active July 24, 2019 06:12
Callback in Laravel collection map function
<?php
class Cal
{
function multiply(int $number)
{
return $number * 10;
}
}
@bikramtuladhar
bikramtuladhar / callback_using_call_usr_function.php
Last active July 24, 2019 06:13
Call back using call_user_func in php
<?php
function multiplyBy($err, $data, $multiplyByNumber) {
if ($err) {
throw $err;
}
return intval($data)*intval($multiplyByNumber);
};
@bikramtuladhar
bikramtuladhar / php_call_back_using_reflectionFunction.php
Last active July 24, 2019 05:06
PHP callback using func_get_args and ReflectionFunction
<?php
function addition(int $a, int $b)
{
return $a + $b;
}
function subtraction(int $a, int $b)
{
return $a - $b;
@bikramtuladhar
bikramtuladhar / index.php
Last active July 24, 2019 06:18
PHP callback example
<?php
function addition(int $a, int $b)
{
return $a + $b;
}
function subtraction(int $a, int $b)
{
return $a - $b;