Skip to content

Instantly share code, notes, and snippets.

View niloyniloy's full-sized avatar

Niloy Niloy niloyniloy

  • Feni , Bangladesh
View GitHub Profile
@niloyniloy
niloyniloy / Nginx Configuration for CodeIgniter
Created November 11, 2015 13:40
Nginx Configuration for CodeIgniter
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
@niloyniloy
niloyniloy / Export by CSV from Database table
Created November 5, 2015 16:09
Export by CSV from Database table
<?php
// Database Connection
$host="localhost";
$uname="root";
$pass="";
$database = "myshaj";
$connection=mysql_connect($host,$uname,$pass);
@niloyniloy
niloyniloy / PHPExcel_Formula_Debugging.md
Created October 12, 2015 14:49 — forked from MarkBaker/PHPExcel_Formula_Debugging.md
PHPExcel formula debugging (prior to 1.7.9)

PHPExcel formula debugging

Prior to version 1.7.9

/** Error reporting */
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
date_default_timezone_set('Europe/London');
@niloyniloy
niloyniloy / MySQL database backup script
Created October 4, 2015 03:55
MySQL Database Back Up Script wriiten in PHP
<?php
backup_tables('localhost','root','','myshaj');
/* backup the db OR just a table */
function backup_tables($host,$user,$pass,$name,$tables = '*')
{
$link = mysql_connect($host,$user,$pass);
@niloyniloy
niloyniloy / Sort Array.php
Created September 30, 2015 18:09
A simple php script to sort multi-dimensional associative array
$sort_col = array();
foreach ($array as $key=> $row) {
$sort_col[$key] = $row['array_sorting_key'];
}
array_multisort($sort_col, SORT_ASC, $array);
@niloyniloy
niloyniloy / ip_address.php
Last active September 16, 2015 11:52
Getting IP address From a User in PHP
<?php
if (!empty($_SERVER["HTTP_CLIENT_IP"]))
{
//check for ip from share internet
$ip = $_SERVER["HTTP_CLIENT_IP"];
}
elseif (!empty($_SERVER["HTTP_X_FORWARDED_FOR"]))
{
// Check for the Proxy User
@niloyniloy
niloyniloy / Android Push Notification
Last active September 30, 2015 18:06 — forked from prime31/gist:5675017
Simple PHP script showing how to send an Android push notification. Be sure to replace the API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call scriptName.php?id=THE_DEVICE_REGISTRATION_ID
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array