Skip to content

Instantly share code, notes, and snippets.

View vishnukumarpv's full-sized avatar

VISHNUKUMAR P V vishnukumarpv

View GitHub Profile
@vishnukumarpv
vishnukumarpv / class.database.php
Last active August 29, 2016 09:56 — forked from jonashansen229/class.database.php
PHP OOP Database class using MySQLI and Singleton pattern. Only one instance of the class will be made, this requires less memory.
<?php
/*
* Mysql database class - only one connection alowed
*/
class Database {
private $_connection;
private static $_instance; //The single instance
private $_host = "HOSTt";
private $_username = "USERNAME";
private $_password = "PASSWORd";
@vishnukumarpv
vishnukumarpv / Validate.php
Created October 26, 2016 08:19 — forked from azrulharis/Validate.php
Php validation using array and display error on each form fields
<?php
class Validate {
public $message = array();
public $validate;
public function rules($data) {
foreach($data as $key => $value) {
@vishnukumarpv
vishnukumarpv / file_extension_to_mimetype.php
Created November 21, 2016 07:51
MIME Types by file extension in a PHP array
$types = array(
'ai' => 'application/postscript',
'aif' => 'audio/x-aiff',
'aifc' => 'audio/x-aiff',
'aiff' => 'audio/x-aiff',
'asc' => 'text/plain',
'atom' => 'application/atom+xml',
'atom' => 'application/atom+xml',
'au' => 'audio/basic',
'avi' => 'video/x-msvideo',
@vishnukumarpv
vishnukumarpv / handleUpload.php
Created November 25, 2016 09:10 — forked from Abban/handleUpload.php
jQuery AJAX file uploads. Code for the following blog post: http://abandon.ie/notebook/simple-file-uploads-using-jquery-ajax
<?php // You need to add server side validation and better error handling here
$data = array();
if(isset($_GET['files']))
{
$error = false;
$files = array();
$uploaddir = './uploads/';
@vishnukumarpv
vishnukumarpv / media-queries.scss
Created January 4, 2017 04:38 — forked from chrisjlee/media-queries.scss
All Media Queries breakpoints
@media (min-width:320px) { /* smartphones, portrait iPhone, portrait 480x320 phones (Android) */ }
@media (min-width:480px) { /* smartphones, Android phones, landscape iPhone */ }
@media (min-width:600px) { /* portrait tablets, portrait iPad, e-readers (Nook/Kindle), landscape 800x480 phones (Android) */ }
@media (min-width:801px) { /* tablet, landscape iPad, lo-res laptops ands desktops */ }
@media (min-width:1025px) { /* big landscape tablets, laptops, and desktops */ }
@media (min-width:1281px) { /* hi-res laptops and desktops */ }
@vishnukumarpv
vishnukumarpv / ExampleController.php
Created February 28, 2022 05:47 — forked from rakeshjames/ExampleController.php
Drupal 8 Custom module example
<?php
/**
* @file
* @author Rakesh James
* Contains \Drupal\example\Controller\ExampleController.
* Please place this file under your example(module_root_folder)/src/Controller/
*/
namespace Drupal\example\Controller;
/**
* Provides route responses for the Example module.