Skip to content

Instantly share code, notes, and snippets.

View bilal-kilic's full-sized avatar
🐍

Bilal Kılıç bilal-kilic

🐍
View GitHub Profile
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block, everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
@bilal-kilic
bilal-kilic / CoroutinesUtils.kt
Created September 16, 2019 08:31 — forked from jivimberg/CoroutinesUtils.kt
SQS Consumer using Kotlin coroutines and pool of workers.
package com.jivimberg.sqs.published
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.isActive
import kotlinx.coroutines.yield
import java.lang.Thread.currentThread
suspend fun CoroutineScope.repeatUntilCancelled(block: suspend () -> Unit) {
while (isActive) {
@bilal-kilic
bilal-kilic / build.gradle
Created July 10, 2019 20:17 — forked from thom-nic/build.gradle
find the largest classnames in Spring libraries. Also find FactoryFactories
/**
* Find the longest class names in Spring.
* Also find FactoryFactory classes.
* a goof-off project by @thom_nic
*/
import java.util.jar.*
defaultTasks 'longest', 'factoryfactory'
@bilal-kilic
bilal-kilic / async-foreach.js
Created March 22, 2019 14:53 — forked from atinux/async-foreach.js
JavaScript: async/await with forEach()
const waitFor = (ms) => new Promise(r => setTimeout(r, ms))
const asyncForEach = (array, callback) => {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array)
}
}
const start = async () => {
await asyncForEach([1, 2, 3], async (num) => {
await waitFor(50)
public sealed class ItemHashPairCacheService : IItemHashPairCacheService
{
private readonly ICacheClient _cacheClient;
private readonly ILogger<ItemHashPairCacheService> _logger;
private static readonly TimeSpan CacheExpiry = TimeSpan.FromDays(30);
public ItemHashPairCacheService(ICacheClient cacheClient, ILogger<ItemHashPairCacheService> logger)
{
_cacheClient = cacheClient ?? throw new ArgumentNullException(nameof(cacheClient));
_logger = logger ?? throw new ArgumentNullException(nameof(logger));