Skip to content

Instantly share code, notes, and snippets.

View sohelrana820's full-sized avatar
💭
I may be slow to respond.

Sohel Rana sohelrana820

💭
I may be slow to respond.
View GitHub Profile
@sohelrana820
sohelrana820 / task-manager-issue-fixing.js
Last active June 3, 2017 22:22
URL decoder (decodeURIComponent) issue fixed of task manger application.
// Open PROJECT_ROOT/plugins/Apps/webroot/js/src/ProjectsCtrl.js and go to line no 6.
projectSlug = decodeURIComponent(projectSlug);
// Add this line after line 6
// Open PROJECT_ROOT/plugins/Apps/webroot/js/src/FeedsCtrl.js and go to line no 11.
$scope.projectSlug = decodeURIComponent($scope.projectSlug);
// Add this line after line 11
// Open PROJECT_ROOT/plugins/Apps/webroot/js/src/LabelsCtrl.js and go to line no 10.
projectSlug = decodeURIComponent(projectSlug);
<?php
// Open PROJECT_ROOT/src/Controller/AppController.php file and go to line no 123 (approximate line or find $this->Auth->allow)
// And then replace this snippet with below snippet.
$this->Auth->allow([
'signup',
'verifyEmail',
'forgotPassword',
'install',
'resetPassword',
'requirements',
@sohelrana820
sohelrana820 / catch-php-output-buffering-data-jquery-ajax.php
Last active December 12, 2023 14:20
Get Streaming Data Over Jquery Ajax
<?php
/**
* Catch php output buffering data over jQuery AJAX
*
* @author: Sohel Rana (me.sohelrana@gmail.com)
* @author url: https://blog.sohelrana.me
* @link: https://blog.sohelrana.me/catch-php-output-buffering-data-jquery-ajax/
* @licence MIT
*/
@sohelrana820
sohelrana820 / cpanel.php
Created May 13, 2017 12:38
Upload File Using cPanel API
<?php
/**
* This is tiny class wrapper for uploading files using Cpanel API
*
* @author: Sohel Rana <me.sohelrana@gmail.com>
* @url: https://blog.sohelrana.me/upload-file-using-cpanel-api/
* @license: MIT
*/
@sohelrana820
sohelrana820 / parsing_xml_with_multiple_namespaces.php
Last active April 30, 2022 07:30
Parsing XML with multiple namespaces using PHP
<?php
/**
* @author: Sohel Rana
* @url: https://blog.sohelrana.me/parsing-xml-multiple-namespaces-using-php/
* @license: MIT
* Parsing XML with multiple namespaces using PHP
*/
$xmlString = "<en:Envelope xmlns:en=\"http://www.softcare.com/HIPAA/SC/Enrollment/0301\"
xmlns:sc=\"http://www.softcare.com/HIPAA/SC/0203\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
@sohelrana820
sohelrana820 / default.conf
Last active March 6, 2020 06:49
Create NGINX Virtual Host with PHP 7.0
server {
listen 80;
server_name app.example.dev; # Write your server name
root /var/www/PROJECT/PROJECT_ROOT/; # Write your project root here.
access_log /var/log/nginx/PROJECT_ACCESS.log;
error_log /var/log/nginx/PROJECT_ERROR.log;
location / {
index index.php;
@sohelrana820
sohelrana820 / app.yaml
Created April 5, 2017 21:53
Host Static Website in Google App Engine
runtime: php55
api_version: 1.0
service: helloworld
handlers:
# site root
- url: /
static_files: index.html
upload: index.html
<?php
if(isset($iniData['DATABASE_CONFIGURATION_RESULT']) && $iniData['DATABASE_CONFIGURATION_RESULT']){
ConnectionManager::config('application', [
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Mysql',
'persistent' => false,
'host' => $iniData['DATABASE_HOST'],
'username' => $iniData['DATABASE_USERNAME'],
'password' => $iniData['DATABASE_PASSWORD'],
'database' => $iniData['DATABASE_NAME'],
@sohelrana820
sohelrana820 / change_an_array_value_if_duplicate.php
Last active June 30, 2017 08:52
Change an Array Value if Duplicate
<?php
/**
* @author: Sohel Rana <sohelrana820>
* @author uri: http://sohelrana.me
*/
$array = [
[
'cat' => 'Sales',
'data' => 'Park assist',
@sohelrana820
sohelrana820 / config_email_transporter_in_cakephp_runtime.php
Last active March 19, 2017 20:36
Configure email transporter in CakePHP in runtime
<?php
Email::configTransport('transporter_name', [
'className' => 'Smtp',
'host' => 'SMTP_HOST',
'port' => 'SMTP_PORT',
'timeout' => 30,
'username' => 'SMTP_USERNAME',
'password' => 'SMTP_PASSWORD',
]);