Skip to content

Instantly share code, notes, and snippets.

View CanerPatir's full-sized avatar
🚀

Caner Patır CanerPatir

🚀
View GitHub Profile
@CanerPatir
CanerPatir / suspend-function.kt
Last active September 15, 2019 09:43
Kotlin-Coroutine
suspend fun someSuspendableOperation(): String {
delay(1000L) // representation of IO operation like going to DB
return "hello"
}
#!/bin/zsh
for i in */.git;
do ( echo $i; cd $i/..; git pull; git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done );
done
@CanerPatir
CanerPatir / MyTask.cs
Last active April 22, 2019 16:39
Simple in memory scheduled job implementation for .net core
public class MyTask : ScheduleTask
{
public MyTask(IServiceScopeFactory serviceScopeFactory) : base(serviceScopeFactory)
{
}
protected override string CronExpression => "*/10 * * * *";
public override Task Execute(IServiceProvider serviceProvider)
{
@CanerPatir
CanerPatir / PipelineStep.java
Last active August 25, 2020 21:48
Simple pipeline implementation to supply fluent and readable DSLs for business workflows through using Java 8 functional features
@FunctionalInterface
public interface PipelineStep<I, O, Ctx> {
static <I, O, Ctx> PipelineStep<I, O, Ctx> of(PipelineStep<I, O, Ctx> source) {
return source;
}
O execute(I value, Ctx context) throws Exception;
default <R> PipelineStep<I, R, Ctx> pipe(PipelineStep<O, R, Ctx> next) {
@CanerPatir
CanerPatir / A lightweight message bus using TPL DataFlow
Last active July 26, 2023 08:02 — forked from benfoster/gist:4416655
A lightweight message bus using TPL DataFlow
using System;
using System.Collections.Concurrent;
using System.Threading;
using System.Threading.Tasks;
using System.Threading.Tasks.Dataflow;
namespace TDFDemo
{
class Program
{