Skip to content

Instantly share code, notes, and snippets.

View himan72's full-sized avatar

Mohammed Hicham himan72

View GitHub Profile
@himan72
himan72 / 0_reuse_code.js
Created March 31, 2017 19:40
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@himan72
himan72 / ssh.txt
Created July 8, 2018 20:32 — forked from bradtraversy/ssh.md
SSH & DevOps Crash Course Snippets
# Login via SSH with password (LOCAL SERVER)
> ssh brad@192.168.1.29
# Create folder, file, install Apache (Just messing around)
mkdir test
cd test
touch hello.txt
sudo apt-get install apache2
# Generate Keys
@himan72
himan72 / webdev.md
Created July 16, 2018 17:54
web resource
@himan72
himan72 / normalize.flexbox.css
Created September 13, 2018 20:36
Normalizing Cross-browser Flexbox Bugs
.Site {
display: flex;
flex-direction: column;
height: 100vh; /* 1 */
}
.Site-header,
.Site-footer {
flex-shrink: 0; /* 2 */
}
.Site-content {
@himan72
himan72 / Readme.md
Created October 1, 2018 13:39 — forked from ErikCH/Readme.md
@himan72
himan72 / Readme.md
Created October 1, 2018 13:39 — forked from ErikCH/Readme.md
<?php
namespace App\Traits;
/**
* Trait SecureUpdatable
* Allows to secure update without override the existing fields in a model
* This dependes on the $fillable and $guarded attributes too
* @package App\Traits
*/
trait SecureUpdatable
{
@himan72
himan72 / 1_Laravel_state-machine.md
Created October 24, 2018 19:29 — forked from iben12/1_Laravel_state-machine.md
Laravel: State-machine on Eloquent Model

Implementing State Machine On Eloquent Model*

* Update (12.09.2017): I have improved the trait so that it can be used with objects other than Eloquent Models.

Some days ago I came across a task where I needed to implement managable state for an Eloquent model. This is a common task, actually there is a mathematical model called "Finite-state Machine". The concept is that the state machine (SM) "can be in exactly one of the finite number of states at any given time". Also changing from one state to another (called transition) depends on fulfilling the conditions defined by its configuration.

Practically this means you define each state that the SM can be in and the possible transitions. To define a transition you set the states on which the transition can be applied (initial conditions) and the only state in which the SM should be after the transition.

That's the theory, let's get to the work.

@himan72
himan72 / deployment_guide.md
Created March 24, 2019 07:11 — forked from vicgonvt/deployment_guide.md
Deployment Guide for Ubuntu Server from Scratch with Laravel

Setting Up Laravel in Ubuntu / DigitalOcean

Getting Started

  • Create droplet with Ubuntu 18.10
  • ssh root@[DROPLET IP ADDRESS]
  • Get password from your email
  • Change password on first login
  • adduser laravel
  • Enter password and other information