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 / PhpExcel Image
Created February 22, 2019 09:06
PhpExcel Image
<?php
error_reporting(-1);
ini_set('display_errors', 'On');
require_once(dirname(__FILE__).'/vendor/PHPExcel.php');
$cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_sqlite3;
if (!PHPExcel_Settings::setCacheStorageMethod($cacheMethod)) {
die($cacheMethod . " caching method is not avaiLabel" . EOL);
}
$objPHPExcel = new PHPExcel();
@Guley
Guley / Sorr_by_key
Created March 9, 2019 10:01
php multidimensional array sort by key
$arr = [
"0": [
"id": 1,
"schedule_time": "01:01 AM",
"day": "Thu"
],
"1": [
"id": 2,
"schedule_time": "04:00 AM",
"day": "Sun"
@Guley
Guley / GetWeekNextDays
Created March 10, 2019 08:01
Get all next week days from current date
<html>
<head>
<title>Online PHP Script Execution</title>
</head>
<body>
<?php
$day = Date('N',strtotime('2019-03-13 02:00:00'));
$weekArr = ['Mon','Tue','Wed','Thu','Fri','Sat','Sun'];
$newDaysArr=[];
foreach($weekArr as $key=>$val){
@Guley
Guley / NextDateByDay
Created March 20, 2019 06:06
Php get next week date by current week day name
<?php
$nextKeyday = strtotime('Mon');
$nextWeek = strtotime("+7 day",$nextKeyday);
echo date('Y-m-d',$nextWeek);
?>
@Guley
Guley / CkeditorWithCkFinder
Created April 10, 2019 04:51
Configuration files to upload images over ckeditor using ckfinder
/*CkEditor config.js */
CKEDITOR.replace( "short_desc", {
filebrowserBrowseUrl: 'http://example.com/ckfinder/ckfinder.html',
filebrowserImageBrowseUrl: 'http://example.com/ckfinder/ckfinder.html?Type=Images',
filebrowserUploadUrl: 'http://example.com/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
filebrowserImageUploadUrl: 'http://example.com/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
filebrowserWindowWidth: '1000',
filebrowserWindowHeight: '700'
@Guley
Guley / Laravel remove public and index.php
Last active October 29, 2020 20:00
Laravel 5 remove public and index.php
**In order to use mod_rewrite you can type the following command in the terminal:**
# Unable rewrite mode
sudo a2enmod rewrite
# Disable rewrite mode
sudo a2dismod rewrite
@Guley
Guley / php-instagram
Created May 10, 2019 05:27
Get instagram data using php and curl
protected function instagram(){
$access_token = 'xxxxxx';
$fullendpoint = 'https://api.instagram.com/v1/users/self/media/recent/';
$endpoint = 'users/self/media/recent/';
$params = array(
'access_token' => $access_token,
'count' => '10',
'min_tag_id' => '',
'max_tag_id' => ''
);
@Guley
Guley / unique_multidimensional_array
Created May 20, 2019 05:03
Unique multidimensional array in php
<?php
function unique_multidim_array($array, $key) {
$temp_array = array();
$i = 0;
$key_array = array();
foreach($array as $val) {
if (!in_array($val[$key], $key_array)) {
$key_array[$i] = $val[$key];
$temp_array[$i] = $val;
@Guley
Guley / Php-Upload-Image-Crop
Created May 31, 2019 06:00
Php Upload Image Crop plugin
Create a folder named as **uploads**
# HTML
<html lang="en">
<head>
<title>PHP and jQuery - Crop Image and Upload using Croppie plugin</title>
</head>
<body>
@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/%'