Skip to content

Instantly share code, notes, and snippets.

View smarteist's full-sized avatar
🙂
I may be slow to respond.

Ali Hosseini smarteist

🙂
I may be slow to respond.
View GitHub Profile
@smarteist
smarteist / sql-cheatsheet.md
Last active April 27, 2024 17:45
SQL cheat sheet

SQL languages

DDL is short name of Data Definition Language, which deals with database schemas and descriptions, of how the data should reside in the database.

DCL is short name of Data Control Language which includes commands such as GRANT, and mostly concerned with rights, permissions and other controls of the database system.

DML is short name of Data Manipulation Language which deals with data manipulation, and includes most common SQL statements such INSERT, UPDATE, DELETE etc, and it is used to store, modify, delete and update data in database.

DQL is short name of Data Query Language which used for performing queries on the data within schema objects. The purpose of the DQL Command is to get some schema relation based on the query passed to it. SELECT statement is used to retrieve data from the database.

@smarteist
smarteist / view.php
Created July 15, 2021 08:11
How to render views in php
<?php
function renderView($filePath, $variables = array(), $print = true)
{
$output = NULL;
if(file_exists($filePath)){
// Start output buffering
ob_start();
@smarteist
smarteist / toGeneralChar.html
Last active June 14, 2021 07:22
Arabic and Persian Characters to general form
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>

General Form

<major>.<minor>.<patch> ==example==> 1.2.3

<major>.<minor>.<patch>-beta.<beta> ==example==> 1.2.3-beta.2

Version Prefix

@smarteist
smarteist / Laravel-Container.md
Created January 5, 2021 17:44
Laravel's Dependency Injection Container in Depth

Laravel's Dependency Injection Container in Depth

Translations: Korean (by Yongwoo Lee)

Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.

Introduction to Dependency Injection

I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).

@smarteist
smarteist / xdebug-on-linux.md
Last active June 11, 2021 05:11
PHP xDebug on Linux/Mac and phpStorm

Install and Configure xDebug 🪲 on Linux for PhpStorm 🐘

  • Assuming that you have already installed php and apache
  • Install xDebug php extension

# Arch Linux , Manjaro
sudo pacman -Sy xdebug

# Ubuntu 16.04,18.04
@smarteist
smarteist / default.conf
Last active March 2, 2022 17:14
This is a local webserver configuration for nginx on LEMP stack plus phpmyadmin.
server {
listen 80;
listen [::]:80;
#listen 443 ssl http2;
server_name localhost .localhost;
charset utf-8;
root "/srv/www/nginx/";
index index.php index.html index.htm;
gzip off;
@smarteist
smarteist / print.js
Last active October 29, 2020 14:45
create printable window with java script
jQuery(document).ready(function ($) {
$("#printme").click(function () {
var bodyContent = '';
$('body').find('.printable').each(function (index, object) {
bodyContent += $(object).html();
});
var headStyles = '';
$('head').find('link[rel="stylesheet"]').each(function (index, object) {
headStyles += '<link href="' + $(object).attr('href') + '" rel="stylesheet"/>';
@smarteist
smarteist / git essential commands.md
Last active September 17, 2023 11:53
git essential commands
current git version
git --version
git global user config
@smarteist
smarteist / liveBlur.dart
Created March 14, 2020 19:13
Its a live blur view for flutter
import 'dart:ui';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
// ignore: must_be_immutable
class MovableStackItem extends StatefulWidget {
Widget _child;
double _radius;
Color _color;