Skip to content

Instantly share code, notes, and snippets.

View nasirkhan's full-sized avatar
🚀
Focusing

Nasir Khan Saikat nasirkhan

🚀
Focusing
View GitHub Profile
@nasirkhan
nasirkhan / prepate_select.php
Last active October 1, 2016 07:00
Show Name and Code as Text using Laravel Lists method
<?php
// Show Name and Code as Text using Laravel Lists method,
// this array of data will be passed as value to prepate HTML Select Dropdown
$institutes = Institute::select(DB::raw("CONCAT(name,' (', code, ')') AS text, id"))->lists('text', 'id')->take(5);
@nasirkhan
nasirkhan / .htaccess
Created September 18, 2016 06:10
Run PHP 7 on Hostgator
# Add this line at the very first line
AddType application/x-httpd-php70 .php
@nasirkhan
nasirkhan / file-permission-change.sh
Created August 23, 2016 10:49
Fix the file and folder/directory permission on Linux
# For directories only do this.
find . -type d -exec chmod 755 {} \;
# For files only do this.
find . -type f -exec chmod 644 {} \;
@nasirkhan
nasirkhan / mysql_pdo_connect.php
Last active August 8, 2018 09:06
MySQL PDO Unicode Issue fix
<?php
/*
* The following function will create a PDO connection form PHP.
* It sovles the issue of inserting the Unicode Characters.
*/
function connect_db() {
$servername = "localhost";
$db_username = "root";
$db_password = "root";
@nasirkhan
nasirkhan / go_back.md
Created March 26, 2016 08:05
“Go Back” Button for the HTML/Javascript/PHP forms

“Go Back” Button

Input button with inline JavaScript

<input type="button" value="Go Back!" onclick="history.back(-1)" />

PHP solution for the Back Button

@nasirkhan
nasirkhan / API Format.md
Last active March 7, 2016 07:04
REST API Documenting Example

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@nasirkhan
nasirkhan / migration_class_not_found_issue.md
Last active September 4, 2015 08:40
Laravel migration rollback issue, class not found
php composer.phar dump-autoload

or just use

composer dump-autoload
@nasirkhan
nasirkhan / git command.md
Last active June 14, 2016 12:26
git discart local changes and pull form origin
git fetch --all
git reset --hard origin/master
@nasirkhan
nasirkhan / update_git_branch_from_master.markdown
Last active August 29, 2015 14:02
Git | Update a git Branch form Master

Checkout the branch git checkout Branch_01

Then merge: git merge origin/master

Then push: git push origin master

@nasirkhan
nasirkhan / mysql_show_column_names
Last active August 29, 2015 14:01
Get all the column names of a MySQL database table
/*
* MY_DATABASE_NAME will be replaced by the name of your database
* MY_TABLE_NAME will be repaced by the name of your database table
*/
SELECT
`COLUMN_NAME`
FROM
`INFORMATION_SCHEMA`.`COLUMNS`
WHERE