Skip to content

Instantly share code, notes, and snippets.

@Rakesh-webdeveloper
Rakesh-webdeveloper / mysql-triggers.sql
Created May 10, 2018 07:48 — forked from anytizer/mysql-triggers.sql
The mysql triggers examples
# INSERT
# -- before: Check uniqueness
# -- after:
# UPDATE
# -- before: Log old data
# -- after: Email admin queue
# DELETE
# -- before: check for dues
# -- after: System cleanup
@Rakesh-webdeveloper
Rakesh-webdeveloper / youtube_id_regex.php
Created August 1, 2018 06:34 — forked from ghalusa/youtube_id_regex.php
Extract the YouTube Video ID from a URL in PHP
<?php
// Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored)
// http://youtu.be/dQw4w9WgXcQ
// http://www.youtube.com/embed/dQw4w9WgXcQ
// http://www.youtube.com/watch?v=dQw4w9WgXcQ
// http://www.youtube.com/?v=dQw4w9WgXcQ
// http://www.youtube.com/v/dQw4w9WgXcQ
// http://www.youtube.com/e/dQw4w9WgXcQ
// http://www.youtube.com/user/username#p/u/11/dQw4w9WgXcQ
@Rakesh-webdeveloper
Rakesh-webdeveloper / clean_code.md
Created August 8, 2018 06:41 — 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

@Rakesh-webdeveloper
Rakesh-webdeveloper / Dockerfile
Created December 11, 2018 05:41 — forked from amitavroy/Dockerfile
Docker setup with Laravel
FROM php:7.2.10-apache-stretch
RUN apt-get update -yqq && \
apt-get install -y apt-utils zip unzip && \
apt-get install -y nano && \
apt-get install -y libzip-dev libpq-dev && \
a2enmod rewrite && \
docker-php-ext-install pdo_pgsql && \
docker-php-ext-install pgsql && \
docker-php-ext-configure zip --with-libzip && \
@Rakesh-webdeveloper
Rakesh-webdeveloper / installation
Created July 16, 2019 20:00
composer and laravel install to wsl
1. install composer
$ curl -sS https://getcomposer.org/installer -o composer-setup.php
$ php -r "if (hash_file('sha384', 'composer-setup.php') === '48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe587c3f0fe57a54d8f5') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
$ sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
Composer (version 1.8.6) successfully installed to: /usr/local/bin/composer
@Rakesh-webdeveloper
Rakesh-webdeveloper / Imageupload.php
Created July 17, 2019 06:27
Method chaining in PHP
<?php
class ImageUplaod {
public $image = array();
public function size ($size) {
$this->image['size'] = $size;
return $this;
}