Skip to content

Instantly share code, notes, and snippets.

View mkdesignn's full-sized avatar

mohammad mkdesignn

View GitHub Profile
image: php:7.4-fpm
pipelines:
default:
# Not needed unless you're doing feature tests.
# - step:
# name: Build
# image: node:8.9.4
# caches:
# - node
# script:
@mkdesignn
mkdesignn / Custom-pagination
Created May 14, 2020 19:42
Custom-pagination
protected function paginate($query)
{
$paginate = $query->paginate($this->row_per_page, null, null, $this->page);
return [$paginate->toArray(), $paginate->render()->toHtml()];
}
@mkdesignn
mkdesignn / CleanText
Last active March 1, 2020 16:36
Clean the text regex
$text = '[IMG][img]https://i.imgur.com/hyj2oZBh.png[/img][/IMG]
[IMG][img]https://i.imgur.com/removed.png[/IMG][/img]
<iframe width="640" height="360" src="https://www.youtube.com/embed/HdYg2EPMKiI?rel=0" frameborder="0" allowfullscreen></iframe>
<iframe height="560" width="40" src="https://www.youtube.com/embed/Xt2lHsDZSYs?rel=0" frameborder="0" allowfullscreen></iframe>
<iframe src="https://www.verticalscope.com/"></iframe>
This is on a 2013 70s edition. I have a video of the problem on youtube if you search. [h]Should remove code without options too[/h]. [h=1]2013 VW Beetle DAB NOT WORKING![/h]';
function cleanTheTextFirstSolution($text)
{
return preg_replace(
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
#!/usr/bin/env bash
! ( diff -y <(grep '.\=' ./.env.example |sort |sed -e 's/=.$//') <(grep '.\=' ./.env |sort |sed -e 's/=.$//') | grep " <")
$s3 = \Storage::disk('s3');
$client = $s3->getDriver()->getAdapter()->getClient();
$expiry = "+10 minutes";
$command = $client->getCommand('GetObject', [
'Bucket' => \Config::get('filesystems.disks.s3.bucket'),
'Key' => "file/in/s3/bucket"
]);
$request = $client->createPresignedRequest($command, $expiry);
@mkdesignn
mkdesignn / gist:7a80a17a695f1eab761ad0777e07862d
Created May 17, 2019 09:32
Send notification in laravel
$this->notificationService($device->device_token, $notification['target_screen'], $message['body'], $message['title']);
function notificationService($token, $targetScreen, $body = "", $title = "")
{
$optionBuilder = new OptionsBuilder();
$optionBuilder->setTimeToLive(60 * 20);
$optionBuilder->setCollapseKey('type_a');
$optionBuilder->setContentAvailable(true);
try {
$optionBuilder->setPriority(OptionsPriorities::high);
function getBranch($belief_id){
$con = DBINT::DBCon();
$qry = "SELECT branch.idbranch, branch.branchname from worldviews inner join branch on branch.idbranch = worldviews.branchid where beliefid = ".$belief_id.' group by branchid';
$stmt = $con->prepare($qry);
$stmt->execute();
$result = $stmt->setFetchMode(PDO::FETCH_ASSOC);
$r = $stmt->fetchAll();
$con = null;
#!/bin/bash
# Basic configuration: datestamp e.g. YYYYMMDD
DATE=$(date +"%Y%m%d")
# Location of your backups (create the directory first!)
BACKUP_DIR="/home/backup/database"
server {
listen 185.13.231.188:500;
root /home/ftp_users/ftp/demo_core/public;
index index.php index.html index.htm;
server_name test.com;
location / {
try_files $uri $uri/ /index.php?$query_string;
}