Skip to content

Instantly share code, notes, and snippets.

@smhnaji
smhnaji / valuable-development-links.md
Last active May 7, 2022 15:17
Valuable development links
@smhnaji
smhnaji / ssh-connection-with-private-key
Created March 8, 2022 18:49
Connect to SSH Server using private key file (used for Digital Ocean, ...)
$ ssh -i ~/ssh-private-keys/private-key.ppk root@1.2.3.4
@smhnaji
smhnaji / .env
Created June 11, 2021 13:28
Laravel 8 Sanctum API .env
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
APP_DEBUG=true
APP_URL=http://path.to.domain.com
LOG_CHANNEL=file
LOG_LEVEL=debug
DB_CONNECTION=mysql

Array definition:

Arrays should be defined using [] instead of the old way: array().

Variable Naming conventions:

  • Form variables should be snake_case.
  • Database tables and columns should be snake_case.
@smhnaji
smhnaji / x.drush.inc
Last active February 15, 2020 14:52
Simplest Drupal 7 drush command
<?php
// This file is belonged to a module called x.
// It's all devoted to the drush commands related to the module.
/**
* Define the drush commands' interface
*/
function x_drush_command()
{
@smhnaji
smhnaji / generatePassword.php
Last active March 26, 2020 23:21
Generate secure and readable password
<?php
public function generate_password($length = 8)
{
$sets = array();
$sets[] = 'abcdefghjkmnpqrstuvwxyz';
$sets[] = 'ABCDEFGHJKMNPQRSTUVWXYZ';
$sets[] = '23456789';
$sets[] = '!@#$^*()_.-=';
$all = '';