Skip to content

Instantly share code, notes, and snippets.

View AhmadWaleed's full-sized avatar

Ahmed waleed AhmadWaleed

View GitHub Profile
package main
import (
"bufio"
"flag"
"fmt"
"log"
"os"
"sort"
"strconv"
#!/bin/bash
laravel new $1
# Change Dir
cd $1
# Update .env
sed -i "s/APP_NAME=Laravel/APP_NAME=$1/g" .env
sed -i "s/DB_DATABASE=laravel/DB_DATABASE=$1/g" .env
@AhmadWaleed
AhmadWaleed / .gitattributes
Created September 25, 2020 06:46
GitAttributes for PHP Composer Projects
# https://php.watch/articles/composer-gitattributes
# Exclude build/test files from archive
/.github export-ignore
/.phive export-ignore
/.psalm export-ignore
/build export-ignore
/docs export-ignore
/examples export-ignore
/phpstan export-ignore
@AhmadWaleed
AhmadWaleed / index.html
Created September 23, 2020 09:52
Github Clone
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
</head>
<body>
@AhmadWaleed
AhmadWaleed / mysql-docker.sh
Created October 31, 2019 04:38 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@AhmadWaleed
AhmadWaleed / installation.md
Last active September 23, 2019 10:03
Install mysql 5.6 on ubuntu 18.04 lte

run all success commands then run

apt-get install -f

after that run all failed commands top to bottom and then run

apt-get install -f -> if succeed then it ask for root password

and then run

@AhmadWaleed
AhmadWaleed / ssh.md
Created September 17, 2019 15:35 — forked from bradtraversy/ssh.md
SSH & DevOps Crash Course Snippets

SSH Cheat Sheet

This sheet goes along with this SSH YouTube tutorial

Login via SSH with password (LOCAL SERVER)

$ ssh [email protected]

Create folder, file, install Apache (Just messing around)

$ mkdir test

$ cd test

// PostsController.php
public function store(PostRequest $request)
{
    $post = Post::create($request->validated());
    
    $post->publish();

    return redirect('/posts');
}
Post extends Model
{
  public function publish()
  {
    $this->published_at = now();
    $this->save();
  }
}
// creating post
$post = Post::create($attributes);

// publish post
$post->published_at = now();
$post->save();