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 / laravel-commans.md
Last active July 22, 2020 11:56
Call laravel routes via command line

http://stackoverflow.com/questions/28866821/call-laravel-controller-via-command-line

There is no way so far (not sure if there will ever be). However you can create your own Artisan Command that can do that. Create a command CallRoute using this:

php artisan make:console CallRoute

This will generate a command class in app/Console/Commands/CallRoute.php. The contents of that class should look like this:

<?php namespace App\Console\Commands;
@nasirkhan
nasirkhan / bengali-webfont.md
Last active February 19, 2020 03:50
Embed Bengali/ Bangla Webfonts with Unicode Range
/* ========================================================================
    Bengali/ Bangla Webfont
    Embed Bengali Webfonts with Unicode Range
	Fonts are hosted at http://nasirkhn.com
 ========================================================================== */

@font-face {
	font-family: 'Siyam Rupali';
	font-style: normal;
@nasirkhan
nasirkhan / config.sh
Created November 8, 2019 05:51
Redirect www to non www domain
## Virtual Host Config
```
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName matholympiad.org.bd
ServerAlias www.matholympiad.org.bd
@nasirkhan
nasirkhan / doc_to_html.sh
Created April 11, 2014 18:16
convert .doc to .html using libreoffice command
# the following command will convert all the files to HTML which has the DOC extension.
find . -name "*.DOC" -type f -print0 |xargs -0 -I {} libreoffice --headless --convert-to html:HTML --outdir /home/nasir/output {}
@nasirkhan
nasirkhan / joomla-ubuntu.sh
Last active January 29, 2019 10:52
Joomla File Folder Permission on Ubuntu server
#!/bin/bash
#
# Fix the folder and file permissions for Joomla installation on Ubuntu server
sudo chown -R www-data.www-data /var/www/html/joomla
sudo chmod -R 755 /var/www/html/joomla
# Following command endabled to option to update the extensions and core joomla cms as well.
# after updating need to fix the permission using the commands mentioned above.
sudo chown $USER:www-data -R /var/www/html/joomla
@nasirkhan
nasirkhan / laravel-pagination-code.php
Created February 24, 2017 08:17
get parameters with pagination, laravel 5
<?php
// get parameters with pagination, laravel 5
// http://stackoverflow.com/questions/17159273/laravel-pagination-links-not-including-other-get-parameters
{!! $myItems->appends(Request::capture()->except('page'))->render() !!}
?>
@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 / 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 / TagController.php
Created April 7, 2018 06:29 — forked from FilipQL/TagController.php
Select2 and Laravel: Ajax Autocomplete
<?php
/* For more details see: http://laraget.com/blog/select2-and-laravel-ajax-autocomplete */
namespace App\Http\Controllers\Select2Ajax;
use App\Tag;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
class TagController extends Controller
@nasirkhan
nasirkhan / request_basicauth.js
Last active March 2, 2018 11:22 — forked from fchasen/request_basicauth.js
Loading this script after epub.js and it should overwrite the EPUBJS.core.request method.Change the login credentials in the file to your servers.USERNAME = 'abc'PASSWORD = 'xyz'
USERNAME = 'abc'
PASSWORD = 'xyz'
EPUBJS.core.request = function(url, type) {
var supportsURL = window.URL;
var BLOB_RESPONSE = supportsURL ? "blob" : "arraybuffer";
var deferred = new RSVP.defer();
var xhr = new XMLHttpRequest();