Skip to content

Instantly share code, notes, and snippets.

View niloyniloy's full-sized avatar

Niloy Niloy niloyniloy

  • Feni , Bangladesh
View GitHub Profile
function Utf8_ansi($valor='') {
$utf8_ansi2 = array(
"\u00c0" =>"À",
"\u00c1" =>"Á",
"\u00c2" =>"Â",
"\u00c3" =>"Ã",
"\u00c4" =>"Ä",
"\u00c5" =>"Å",
"\u00c6" =>"Æ",
<?php
if(!session_id()) {
session_start();
}
require_once __DIR__ . '/vendor/autoload.php'; // change path as needed
$fb = new \Facebook\Facebook([
'app_id' => '',
'app_secret' => '',
<script>
$(document).ready(function(){
function renderSearchResult () {
var searchText = $(".website-search-input").val().trim();
if ( searchText.length < 2 ) {
$(".website-search-result").remove();
@niloyniloy
niloyniloy / .htaccess
Last active September 8, 2018 19:15
CodeIgniter htaccess to remove index.php from url
RewriteEngine on
RewriteBase /your_project_sub_directory/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L]
@niloyniloy
niloyniloy / new
Last active August 8, 2016 18:15
<?php
/**
* @SWG\Swagger(
* basePath="/v1",
* host="api.local",
* schemes={"http"},
* produces={"application/json"},
* consumes={"application/json"},
* @SWG\Info(
@niloyniloy
niloyniloy / Swagger-annotation.php
Created August 7, 2016 20:28
Swagger annotation for generating json
<?php
/**
* @SWG\Swagger(
* basePath="/v1",
* host="api.local",
* schemes={"http"},
* produces={"application/json"},
* consumes={"application/json"},
* @SWG\Info(
@niloyniloy
niloyniloy / download-file.php
Created July 28, 2016 20:16
Download a File in PHP
<?php
$file_name = $_GET['file'];
$file_url = 'http://yoyostudy.com.au/download/' . $file_name;
header('Content-Type: application/octet-stream');
header("Content-Transfer-Encoding: Binary");
header("Content-disposition: attachment; filename=\"".$file_name."\"");
readfile($file_url);
@niloyniloy
niloyniloy / Basic_curl.php
Created March 20, 2016 18:21
Basic cURL in PHP to send or retrive data in/from Remote URL
$url = "http://niloybanik.com/mail_api/index.php";
$content = json_encode(array( 'to'=>$email,
'from'=>'notifications@reminder.com',
'body'=>$msg_content ,
'subject'=>"$user_name sent your reminder" ));
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, false);
@niloyniloy
niloyniloy / Select_ajax.php
Created January 10, 2016 17:29
Select2 Sending Ajax Data
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.js"></script>
<link href="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.1/css/select2.min.css" rel="stylesheet" />
<script src="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.1/js/select2.min.js"></script>
<select class="select2">
<option> Choose an Option </option>
<option> America</option>
<option> Bangladesh</option>
<option> Canada</option>
@niloyniloy
niloyniloy / jQuery DOM search
Created December 29, 2015 06:38
A simple snipet to search insdie dom element