Skip to content

Instantly share code, notes, and snippets.

View rnkoaa's full-sized avatar

Richard Agyei rnkoaa

View GitHub Profile
import React, { useReducer, useEffect, useContext, createContext } from "react";
import "./App.css";
import {
BrowserRouter as Router,
Switch,
Route,
Link,
useParams,
} from "react-router-dom";
@rnkoaa
rnkoaa / index.html
Created December 7, 2019 11:19
chart.js samples.
<!DOCTYPE html>
<html lang="en">
<!-- https://tobiasahlin.com/blog/introduction-to-chartjs/ -->
<!-- https://codepen.io/elisescolaro/details/YaGyMW -->
<!-- https://www.chartjs.org/samples/latest/charts/bar/stacked.html -->
<head>
<meta charset="UTF-8" />
<title></title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.bundle.min.js"></script>
<style>
import io.micronaut.http.HttpResponse
import io.micronaut.http.MutableHttpRequest
import io.micronaut.http.annotation.Filter
import io.micronaut.http.filter.ClientFilterChain
import io.micronaut.http.filter.HttpClientFilter
import mu.KotlinLogging
import org.reactivestreams.Publisher
import org.slf4j.MDC
import java.util.*
@rnkoaa
rnkoaa / Main.java
Created December 17, 2022 17:11
Convert a Yaml File to a Java Properties of Map<String, Object>
public static void main(String[] args) {
try (var inputStream = Main.class.getClassLoader().getResourceAsStream("application.yml")) {
var yamlToProperties = new YamlToProperties(inputStream);
Map<String, Object> stringObjectMap = yamlToProperties.asProperties();
stringObjectMap.forEach((key, value) -> {
System.out.println("Key: " + key + ", Value: " + value);
});
} catch (IOException e) {
System.out.println(e.getMessage());
}
package main
import (
"context"
"fmt"
"os"
"os/signal"
"strings"
"syscall"
"time"
@rnkoaa
rnkoaa / index.html
Created November 9, 2022 00:25
sidebar navigration with minimization to small bar on click inspired by bedimcode
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="css/style.css" />
<title>Bedim Code</title>
</head>
<body id="body-pd">
@rnkoaa
rnkoaa / Retry.java
Created June 30, 2022 11:51 — forked from dtodt/Retry.java
Retrofit2@2.5.0 - Retry Adapter Factory - Call & CompletableFuture
package com.company.retrofit2.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
@rnkoaa
rnkoaa / EitherCallAdapterFactory.kt
Created June 30, 2022 10:36 — forked from marcRDZ/EitherCallAdapterFactory.kt
A custom Retrofit CallAdapter.Factory to handle Response as Either
import arrow.core.Either
import okhttp3.Request
import okio.Timeout
import retrofit2.Call
import retrofit2.CallAdapter
import retrofit2.Callback
import retrofit2.Response
import retrofit2.Retrofit
import java.io.IOException
@rnkoaa
rnkoaa / FlowableUtils.java
Created January 11, 2017 18:12
Convert a listenable future to an rxjava-2 flowable or single
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import io.reactivex.*;
/**
* Created on 1/11/2017.
*/
public class FlowableUtils {
@rnkoaa
rnkoaa / Actor.java
Created April 17, 2022 22:47
Jooq MultiSet select for one-to-many using Sakila DB on Postgresql
public record Actor(int id, String firstName, String lastName) {}