Skip to content

Instantly share code, notes, and snippets.

View iam-raihan's full-sized avatar

Raihan Al-Mamun iam-raihan

View GitHub Profile
@iam-raihan
iam-raihan / process_summernote.php
Created August 8, 2020 14:37
replace summernote image contents with storage path
function processSummerNote($content)
{
if (empty($content)) {
return $content;
}
$content = mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8');
$dom = new \DOMDocument('1.0', 'utf-8');
libxml_use_internal_errors(true);
function objectToArray($object)
{
if(!is_object($object) && !is_array($object)) {
return $object;
}
return array_map('objectToArray', (array) $object);
}
@iam-raihan
iam-raihan / evaly_campaign_notification.js
Created July 1, 2020 23:24
triggers notification when shops are available in a campaign in evaly.com.bd
var campaign = 'evaly-earthquake-july-2020-99c4e2'; // set campaign slug
var pageUrl = `https://evaly.com.bd/campaign/${campaign}`;
var apiUrl = `https://api.evaly.com.bd/core/campaigns/public/${campaign}/shops`;
var delay = 5000; // ms
var showNotification = (msg, shopUrl = null) => {
var notification = new Notification('Evaly', {
icon: 'https://evaly.com.bd/static/images/icons/android-chrome-144x144.png',
body: msg,
});
@iam-raihan
iam-raihan / crypt_mcrypt.php
Created July 10, 2017 22:17
3DES cipher in ECB mode Cryptography in PHP using mcrypt
<?php
/**
* Created by PhpStorm.
* User: Raihan
* Date: 10-Jul-17
* Time: 12:48 AM
*/
class CryptMcrypt{
private $hash;
function __construct($hash){
@iam-raihan
iam-raihan / crypt_openssl.php
Created July 10, 2017 22:16
3DES cipher in ECB mode Cryptography in PHP using openssl
<?php
/**
* Created by PhpStorm.
* User: Raihan
* Date: 10-Jul-17
* Time: 4:37 AM
*/
class CryptOpenssl{
private $hash;
function __construct($hash){