Skip to content

Instantly share code, notes, and snippets.

View Guley's full-sized avatar
🇮🇳
Learning Bot

Gulshan Guley

🇮🇳
Learning Bot
View GitHub Profile
@Guley
Guley / Tcpdf-Watermark
Created January 31, 2020 11:12
Tcpdf add custom text watermark
<?php
require('Pdf.php');
class PDF_Rotate extends Pdf
{
var $angle=0;
function Header()
{
//Put the watermark
$this->SetFont('','B',40);
$this->SetTextColor( 165, 203, 73 );
@Guley
Guley / changeHtdocs
Created January 2, 2020 05:15
Change htdocs location in linux
sudo chown -R $USER /var/www; ln -s /var/www /home/username/htdocs
@Guley
Guley / PHP-Dom-Document-CI
Created November 4, 2019 04:47
Codeigniter Genrate XML Envelope
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class XML extends CI_Controller {
protected $xml;
public function __construct() {
parent::__construct();
$this->xml = new DOMDocument('1.0', 'utf8');
$this->xml->formatOutput = true;
@Guley
Guley / PHP-Dom-Document
Created November 4, 2019 04:36
PHP Genrate XML Envelope
<?php
error_reporting(E_ALL);
ini_set('display_errors', 'on');
$xml = new DOMDocument('1.0', 'utf8');
$xml->formatOutput = true;
$xml->preserveWhiteSpace = false;
$startTag1 = $xml->createElement('startTag1');
@Guley
Guley / ci-database-dump
Last active October 3, 2019 12:28
Export or dump your database tables on one click in codeigniter 3
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Dump extends CI_Controller
{
public function index()
{
$this->load->dbutil();
$tableList=$this->db->query("SELECT t.TABLE_NAME AS tablename FROM INFORMATION_SCHEMA.TABLES AS t WHERE t.TABLE_SCHEMA = 'database_name'")->result_array();
if ($this->dbutil->database_exists('database_name'))
{
@Guley
Guley / ci3-check-class-exist
Created October 1, 2019 07:58
Codeginter 3 check if class exist
public function callexistclass(){
$CI = & get_instance();
$file_name = 'Test';
$file_path = APPPATH.'controllers/' . $file_name . '.php';
$object_name = $file_name;
if (file_exists($file_path)) {
require $file_path;
$CI->$object_name = new $object_name();
var_dump($CI->$object_name);
}
@Guley
Guley / country_currency_list.msql
Last active August 3, 2022 21:06
country with currency html codes list mysql
INSERT INTO `country` (`id`,`country_name`,`code`,`currency_name`, `currency_symbol`, `currency_code`) VALUES
(1, 'Afghanistan', 'AF', '+93', 'Afghan afghani', '&#65;&#102;', 'AFN'),
(2, 'ÅLAND ISLANDS', 'AX', '+358', 'Euro', '&#8364;', 'EUR'),
(3, 'Albania', 'AL', '+355', 'Albanian lek', '&#76;&#101;&#107;', 'ALL'),
(4, 'Algeria', 'DZ', '+213', 'Algerian dinar', '&#1583;&#1580;', 'DZD'),
(5, 'American Samoa', 'AS', '+1684', 'US Dollar', '&#36;', 'USD'),
(6, 'Andorra', 'AD', '+376', 'Euro', '&#8364;', 'EUR'),
(7, 'Angola', 'AO', '+244', 'Angolan kwanza', '&#75;&#122;', 'AOA'),
(8, 'Anguilla', 'AI', '+1264', 'East Caribbean dolla', '&#36;', 'XCD'),
(9, 'Antarctica', 'AQ', '+672', 'No universal currency', '', ''),
@Guley
Guley / DataTables-Append-Fields
Created August 14, 2019 10:09
Add up custom fields in datatable
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link src="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css">
<!-- Latest compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<table id="example-datatables">
<thead>
<tr>
For Ubuntu 18.04 and mysql version 14.14 Distrib 5.7.22 follow the below step to reset the mysql password.
Step 1
sudo systemctl stop mysql
Step 2
sudo systemctl edit mysql
@Guley
Guley / Replace string from column mysql
Created June 14, 2019 07:02
Replace string from column mysql
UPDATE table_name SET column_name = concat('', substring(column_name, 7)) WHERE `column_name` like '%string/%'