Skip to content

Instantly share code, notes, and snippets.

@mustafo
mustafo / IProgressMonitor.php
Created May 21, 2020 10:18
IProgressMonitor interface
<?php
namespace App\Core\Utils\ProgressMonitor;
interface IProgressMonitor {
/**
* Starts a new progress monitor
*
* @param string $title The title of progress monitor
* @param int|null $max
select c.id,
c.number,
dates.date,
closed_balances.balance as closed_balance,
debits.debit,
credits.credit,
sum(
case dates.date
when :start_date then closed_balances.balance + debit - credit
else debit - credit end
@mustafo
mustafo / uuid_example.php
Created February 5, 2020 06:32
uuid_example.php
<?php
$clientId = UUID::generate(); // 82dfc5ba-ec9a-40c8-8cfb-561dbbc09abe
$client = Client::create(['id' => $clientId, 'name' => 'Gulugulu']);
$application = Application::create(['client_id' => $clientId, 'number' => '1']);
@mustafo
mustafo / KafkaConsume.php
Last active January 3, 2019 05:21
Kafka laravel commands
<?php
namespace App\Console\Commands;
use App\Core\Audit\Models\Activity;
use Illuminate\Console\Command;
class KafkaConsume extends Command
{
/**
@mustafo
mustafo / ContactPhonesTest.kt
Created August 31, 2018 04:31
The right way to use one to many relationship in jdbi with kotlin
import org.jdbi.v3.core.kotlin.KotlinMapper
import org.jdbi.v3.core.mapper.RowMapperFactory
import org.junit.jupiter.api.Test
import tj.alif.core.app.db.RepositoryTest
import org.jdbi.v3.core.result.RowView
data class Contact (
val id: Int,
val name: String,
@mustafo
mustafo / ContactPhonesTest.kt
Created August 30, 2018 13:25
Working one to many JDBI mapping
import org.junit.jupiter.api.Test
import tj.alif.core.app.db.RepositoryTest
import org.jdbi.v3.core.result.RowView
import java.lang.Integer
data class Contact (
val id: Int,
val name: String,
var phones: MutableList<Phone> = mutableListOf()