Skip to content

Instantly share code, notes, and snippets.

View asad-awadia's full-sized avatar
☁️
Server Dev

Asad Awadia asad-awadia

☁️
Server Dev
View GitHub Profile
@asad-awadia
asad-awadia / App.java
Created April 14, 2024 19:48 — forked from davepkennedy/App.java
SQLite + JDBI
public class App
{
private static final String JDBC_DRIVER = "org.sqlite.JDBC";
private static final String CONNECTION_STRING = "jdbc:sqlite:/tmp/testdb.db";
public static void main( String[] args ) throws SQLException, ClassNotFoundException {
SQLiteDataSource ds = new SQLiteDataSource();
ds.setUrl("jdbc:sqlite:/tmp/data.db");
DBI dbi = new DBI(ds);
Handle h = dbi.open();
@asad-awadia
asad-awadia / GeoHashUtils.java
Created October 25, 2022 12:58 — forked from klehmann/GeoHashUtils.java
GeoHash utilities in Java
/*
* Copyright (c) 2013 Mindoo GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@asad-awadia
asad-awadia / cartesianProduct.kt
Created March 31, 2022 23:21 — forked from bastman/cartesianProduct.kt
Kotlin collections - leftJoin,innerJoin, ...
infix fun <T,O>List<T>.cartesianProduct(others:List<O>):List<Pair<T,O>> =
flatMap{ t:T->
others.map { o-> Pair(t,o) }
}
inline fun <T, O, R> List<T>.mapCartesianProduct(others: List<O>, transform: (Pair<T, O>) -> R): List<R> =
flatMap { t: T ->
others.map { o -> transform(Pair(t, o)) }
}