Skip to content

Instantly share code, notes, and snippets.

View devmsh's full-sized avatar
👨‍💻
Available for new projects

Mohammed S Shurrab devmsh

👨‍💻
Available for new projects
View GitHub Profile
@devmsh
devmsh / UserUpdateTest.php
Created December 11, 2018 12:13
UserUpdateTest2.php
<?php
class UserUpdateTest extends TestCase
{
public function setUp()
{
parent::setUp();
$this->migrate([
self::DATABASE_MIGRATIONS_USER,
@devmsh
devmsh / UserUpdateTest.php
Last active December 11, 2018 11:41
UserUpdateTest
<?php
class UserUpdateTest extends TestCase
{
use DatabaseMigrations;
public function test_user_can_update_profile()
{
Notification::fake();
Passport::actingAs($user = factory(User::class)->create());
@devmsh
devmsh / with.java
Created May 13, 2018 19:24
Android with|without Databinding
package app.com.datrios.activities;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import com.jaeger.library.StatusBarUtil;
@devmsh
devmsh / TestCase.php
Created May 2, 2018 09:18
quicker Laravel Passport test using fake token generator
<?php
abstract class TestCase extends BaseTestCase{
public function mockPassportToken(): void
{
$factory = \Mockery::mock(PersonalAccessTokenFactory::class);
$factory->shouldReceive('make')->with(\Mockery::any(), \Mockery::any(), \Mockery::any())->andReturn(new PersonalAccessTokenResult("123", "123"));
app()->instance(PersonalAccessTokenFactory::class, $factory);
}
}
<?php
class Container
{
public function make($className){}
public function register($className, $callback){}
}
// initialize the container and register some classes
@devmsh
devmsh / ioc.php
Last active June 19, 2017 12:01 — forked from akramabdulrahman/index.php
IoC implementation
<?php
class B
{
public $name = 'akram';
}
class A
{
private $b;
@devmsh
devmsh / simpleioc.php
Created June 18, 2017 17:42
simple IoC challenge
<?php
class B
{
}
class A
{
private $b;
@devmsh
devmsh / freeat.php
Last active June 18, 2017 12:39
FreeAt challenge solution using Intervals
<?php
use \Achse\Math\Interval\Utils\StringParser\IntegerIntervalStringParser as Parser;
require_once 'vendor/autoload.php';
const FREE_TIME = "01:00:00";
$user = [
"workHours" => [
<?php
require_once 'vendor/autoload.php';
const FREE_TIME = 1;
$user = [
"workHours" => [
["from" => "08:00:00", "to" => "16:00:00"],
[],
<?php
$user = [
"workHours" => [
["from" => "08:00:00", "to" => "16:00:00"],
[],
["from" => "08:00:00", "to" => "16:00:00"],
[],
["from" => "08:00:00", "to" => "16:00:00"],
[],