Skip to content

Instantly share code, notes, and snippets.

View mayoz's full-sized avatar
🧶
If you don't understand it, you can't change it!

Sercan Cakir mayoz

🧶
If you don't understand it, you can't change it!
View GitHub Profile
@mayoz
mayoz / clean_code.md
Created December 10, 2023 23:20 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@mayoz
mayoz / SlackMessage.php
Created June 19, 2023 09:05 — forked from sevenpixels/SlackMessage.php
Add link_names to Slack Notification
<?php
namespace Illuminate\Notifications\Messages;
use Closure;
class SlackMessage
{
/**
* The "level" of the notification (info, success, warning, error).
@mayoz
mayoz / gist:e04ac82bf070d41ef16bd0c5b2db655b
Created September 26, 2020 22:44 — forked from nobuti/gist:3816985
MySQL tables for continent names, country names and their ISO codes
CREATE TABLE IF NOT EXISTS `continents` (
`code` CHAR(2) NOT NULL COMMENT 'Continent code',
`name` VARCHAR(255),
PRIMARY KEY (`code`)
) ENGINE=InnoDB;
INSERT INTO `continents` VALUES
('AF', 'Africa'),
('AS', 'Asia'),
('EU', 'Europe'),
@mayoz
mayoz / opendb.sh
Created September 17, 2020 16:56 — forked from AlexVanderbist/opendb.sh
`opendb` command - opens the database for a Laravel app in your GUI
opendb () {
[ ! -f .env ] && { echo "No .env file found."; exit 1; }
DB_CONNECTION=$(grep DB_CONNECTION .env | grep -v -e '^\s*#' | cut -d '=' -f 2-)
DB_HOST=$(grep DB_HOST .env | grep -v -e '^\s*#' | cut -d '=' -f 2-)
DB_PORT=$(grep DB_PORT .env | grep -v -e '^\s*#' | cut -d '=' -f 2-)
DB_DATABASE=$(grep DB_DATABASE .env | grep -v -e '^\s*#' | cut -d '=' -f 2-)
DB_USERNAME=$(grep DB_USERNAME .env | grep -v -e '^\s*#' | cut -d '=' -f 2-)
DB_PASSWORD=$(grep DB_PASSWORD .env | grep -v -e '^\s*#' | cut -d '=' -f 2-)
@mayoz
mayoz / build.sh
Created May 28, 2020 22:55 — forked from bobbytables/build.sh
Protocol Buffer build script for multiple folders
#!/usr/bin/env bash
# This script is meant to build and compile every protocolbuffer for each
# service declared in this repository (as defined by sub-directories).
# It compiles using docker containers based on Namely's protoc image
# seen here: https://github.com/namely/docker-protoc
set -e
REPOPATH=${REPOPATH-/opt/protolangs}
CURRENT_BRANCH=${CIRCLE_BRANCH-"branch-not-available"}
@mayoz
mayoz / global-gitignore.md
Created December 2, 2019 09:04 — forked from subfuzion/global-gitignore.md
Global gitignore

There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.

All other files should be in your own global gitignore file. Create a file called .gitignore in your home directory and add anything you want to ignore. You then need to tell git where your global gitignore file is.

Mac

git config --global core.excludesfile ~/.gitignore

Windows

git config --global core.excludesfile %USERPROFILE%\.gitignore
@mayoz
mayoz / default
Created April 5, 2017 07:30 — forked from dtomasi/default
Brew Nginx PHP7
server {
listen 80;
server_name localhost;
root /Users/YOUR_USERNAME/Sites;
access_log /Library/Logs/default.access.log main;
location / {
include /usr/local/etc/nginx/conf.d/php-fpm;
}
@mayoz
mayoz / remover.sh
Created March 27, 2016 12:53 — forked from iamajeesh/remover.sh
Remove all error_logs form the server using ssh sentos
#without confirmation
find . -name "error_log" -exec rm -rf {} \;
#with confirmation
find . -name "error_log" -exec rm -i {} \;
@mayoz
mayoz / gist:7afad96610abb55d8f53
Created October 8, 2015 19:51 — forked from prime31/gist:5675017
Simple PHP script showing how to send an Android push notification. Be sure to replace the API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call scriptName.php?id=THE_DEVICE_REGISTRATION_ID
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array