Skip to content

Instantly share code, notes, and snippets.

View mskoroglu's full-sized avatar
👨‍💻

Mustafa Köroğlu mskoroglu

👨‍💻
View GitHub Profile
@mskoroglu
mskoroglu / pom.xml
Created February 24, 2017 22:49
Build executable JAR with Spring Boot Maven Plugin — Non-Spring projects
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
@mskoroglu
mskoroglu / in-project-repository.xml
Created February 25, 2017 07:19
Adding unmanaged dependencies to a Maven project
<!--
project structure
=============================================
- libs
- com.example
- 1.1
- test-1.1.jar
- org.example
- 3.4
- test-3-4.jar
@mskoroglu
mskoroglu / Dockerfile
Created October 26, 2017 08:52
Dockerfile | Timezone
RUN tz=Europe/Istanbul && cp -vf /usr/share/zoneinfo/$tz /etc/localtime && echo $tz | tee /etc/timezone
@mskoroglu
mskoroglu / KTable.kt
Last active April 20, 2022 08:26
jQuery DataTables with Kotlin
/**
* @author Mustafa Köroğlu
*/
const val kTableFunction = """
function kTable(table, configURL, cb) {
$.post(configURL, function (config) {
config.options.ajax.data = JSON.stringify;
config.column = function (columnName) {
return config.options.columns.filter(function (row) {
return row.name === columnName;
@mskoroglu
mskoroglu / Repeat.js
Last active April 20, 2022 08:26
react repeat component
/**
* usage:
* <ul>
* <Repeat times="3">
* <li>item</li>
* </Repeat>
* </ul>
* or
* <ul>
* <Repeat times="3">
@mskoroglu
mskoroglu / ClientSide.js
Created November 5, 2019 21:53
React SSR ClientSide component
import React from "react";
export const ClientSide = ({ children, placeholder, delay }) => {
const [showState, setShowState] = React.useState(false);
const delayInMillis = delay !== undefined ? parseInt(delay) : 0;
React.useEffect(() => {
const timeout = setTimeout(() => setShowState(true), delayInMillis);
return () => clearTimeout(timeout);
}, []);
import React from "react";
import { withState, multiState } from "./multi-state";
const Input = ({ state, ...props }) => (
<input
value={state.value}
onChange={e => state.setValue(e.target.value)}
{...props}
/>
);
@mskoroglu
mskoroglu / LocaleSortingExtensions.kt
Last active July 6, 2022 09:34
Kotlin extension functions for sorting by locale(lang, country)
// Example: cities.sortedWithLocaleBy(Locale("tr")) { it.name }
inline fun <T, R : Comparable<R>> Iterable<T>.sortedWithLocaleBy(
locale: java.util.Locale,
crossinline selector: (T) -> R?
) = sortedWith(compareBy(java.text.Collator.getInstance(locale), selector))
// Example: cities.sortedWithLocaleByDescending(Locale("tr")) { it.name }
inline fun <T, R : Comparable<R>> Iterable<T>.sortedWithLocaleByDescending(
locale: java.util.Locale,
crossinline selector: (T) -> R?
@mskoroglu
mskoroglu / database.ts
Created December 29, 2020 07:48
Next.js with TypeORM - Database connection
import "reflect-metadata";
import {
Connection,
createConnection,
EntityTarget,
getConnectionManager,
Repository,
} from "typeorm";
import { Post } from "./posts/Post";
@mskoroglu
mskoroglu / docker-compose.yml
Created October 26, 2021 14:28
Bitnami PostgreSQL Images - Pgpool-II & repmgr
version: '3'
volumes:
pg_0_data:
driver: local
pg_1_data:
driver: local
services:
pg-0: