Skip to content

Instantly share code, notes, and snippets.

View vrkansagara's full-sized avatar
😀
Coding :-)

Vallabh Kansagara vrkansagara

😀
Coding :-)
View GitHub Profile
<?php echo 'Hello World!!! ';
@vrkansagara
vrkansagara / User.php
Last active August 29, 2015 14:20 — forked from Ocramius/User.php
<?php
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity()
* @ORM\Table(name="user")
*/
class User
@vrkansagara
vrkansagara / logErrors.php
Created August 26, 2015 06:59
This snippest is for getting errors on currnet working directory.
<?php
if (function_exists ('ini_set')){
//prevent display errors
ini_set("display_errors", 0);
//but log them
ini_set('log_errors', 1 );
//in the document root
ini_set('error_log', getcwd().'/error.log' );
}
@vrkansagara
vrkansagara / .htaccess
Created August 26, 2015 07:03
universal .htaccess file for the php project.
setEnv APPLICATION_ENV development
#setEnv APPLICATION_ENV production
RewriteEngine On
# The following rule tells Apache that if the requested filename
# exists, simply serve it.
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
# The following rewrites all other queries to index.php. The
@vrkansagara
vrkansagara / gist:d22d19772288db109c59
Last active August 26, 2015 07:04 — forked from ejsiddiqui/gist:4f11cd3f829059a0d792
Mobile Device Detection via User Agent RegEx

#Mobile Device Detection via User Agent RegEx

Yes, it is nearly 2012 and this exercise has been done to death in every imaginable language. For my own purposes I needed to get the majority of non-desktop devices on to a trimmed down, mobile optimized version of a site. I decided to try and chase down an up-to-date RegEx of the simplest thing that could possibly work.

I arrived at my current solution after analyzing 12 months of traffic over 30+ US based entertainment properties (5.8M+ visitors) from Jan - Dec 2011.

The numbers solidified my thoughts on the irrelevancy of including browsers/OSes such as Nokia, Samsung, Maemo, Symbian, Ipaq, Avant, Zino, Bolt, Iris, etc. The brass tacks of the matter is that you certainly could support these obscure beasts, but are you really going to test your site on them? Heck, could you even find one?! Unless the folks that pay you are die hard Treo users my guess is "No".

Interestingly enough my research shows that /Mobile/ is more efficient than **/iP(

@vrkansagara
vrkansagara / CI_Upload.php
Created September 8, 2015 16:01
upload image file.
<?php
/**
* Created by PhpStorm.
* User: vallabh
* Date: 08/09/15
* Time: 17:34
*/
class Test extends CI_Controller
{
@vrkansagara
vrkansagara / CI_Upload -form.php
Created September 8, 2015 16:02
relate to CI_Upload.php
<?php
/**
* Created by PhpStorm.
* User: vallabh
* Date: 08/09/15
* Time: 17:31
*/
?>
<html>
<head>
@vrkansagara
vrkansagara / CI_Upload-upload_success.php
Created September 8, 2015 16:04
related to CI_Upload.php
<?php
/**
* Created by PhpStorm.
* User: vallabh
* Date: 08/09/15
* Time: 17:33
*/
?>
<html>
<head>
@vrkansagara
vrkansagara / CI_Upload-upload.php
Created September 8, 2015 16:05
relate to CI_Upload.php
<?php
/**
* Created by PhpStorm.
* User: vallabh
* Date: 08/09/15
* Time: 18:51
*/
$config['upload_path'] = APPPATH. '/data';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = 100;
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName git.local
ServerAlias git.local
# Indexes + Directory Root.
#http://debian-handbook.info/browse/stable/sect.http-web-server.html
#DirectoryIndex index.php index.html index.htm