Skip to content

Instantly share code, notes, and snippets.

@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;
}
@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 / 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 / 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 / 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 / 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
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="../asstes/css/bootstrap/bootstrap.min.css"/>
<link rel="stylesheet" href="layout-3.css">
@Rakesh-webdeveloper
Rakesh-webdeveloper / layout.htm
Created April 25, 2018 12:03 — forked from AdamAlinauskas/layout.htm
Web page layout using divs with a header, footer, right sidebar, left sidebar and an area for main content.
<html>
<head>
<style>
#header{
background-color: lightblue;
width:100%;
height:50px;
text-align: center;
}
<?php
/**
* Get Google Page Speed Screenshot
*
* Uses Google's Page Speed API to generate a screenshot of a website.
* Returns the image as a base64 jpeg image tag
*
* Usage Example:
* echo getGooglePageSpeedScreenshot("http://ghost.org", 'class="thumbnail"');
*
@Rakesh-webdeveloper
Rakesh-webdeveloper / text
Created April 3, 2018 07:52 — forked from d1i1m1o1n/text
How to disable auto-save in phpstorm
How to disable auto-save:
Go to File > Settings (Ctrl+Alt+S).
Go to Appearance & Behavior > System Settings.
Make sure the two are unchecked:
Save files on frame deactivation
Save files automatically if application is idle for x sec.
Go to Editor > General > Editor Tabs
Put a checkmark on "Mark modified files with asterisk"
(Optional but recommended) Under "Tab Closing Policy", select "Close non-modified files first". You may also want to increase the number of allowed tabs.
Click Apply > OK.