This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* What's a happy number? https://en.wikipedia.org/wiki/Happy_number | |
* | |
* Simple brute force solution that just evaluates if the happy number sequence reaches one within [MAX_DEPTH] iterations. | |
*/ | |
object HappyNumbers { | |
const val MAX_DEPTH = 10_000 | |
@JvmStatic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Custom postfix templates useful for postgis functions - created by tuesd4y | |
# see www.tuesd4y.com | |
.trans : transform geometry into WG84 (=SRID 4326) | |
ANY -> ST_TRANSFORM($expr$, 4326) | |
.transform : transform geometry into another CRS | |
ANY -> ST_TRANSFORM($expr$, $NAME#1::4326$) | |
.trans3 : transform geometry into 3035 lambert azimuthal covering europe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
502612 | Kumpu 100g Bag(Green Tea) | Gift Wrapping?:No | 2000 | |
---|---|---|---|---|
408612 | Hekiun 100g Bag(Green Tea) | Gift Wrapping?:No | 1400 | |
602102 | Kuki Hojicha (Roasted Stems) 100g Bag(Green Tea) | Gift Wrapping?:No | 500 | |
606612 | Gokujo Genmaicha 100g Bag(Green Tea) | Gift Wrapping?:No | 450 | |
133624 | Horai-no-mukashi 20g Can(Green Tea) | Gift Wrapping?:No | 1100 | |
182024 | Shoin-no-mukashi 20g Can(Green Tea) | Gift Wrapping?:No | 1500 | |
103644 | Sayaka-no-mukashi 40g Can (Green Tea) | Gift Wrapping?:No | 2200 | |
643402 | Mugicha (Barley Tea) 400g Bag | Gift Wrapping?:No | 380 | |
642152 | Uji-Shimizu 150g Bag(Green Tea) | Gift Wrapping?:No | 300 | |
136623 | Enishi-no-shiro 20g Box(Green Tea) | Gift Wrapping?:No | 600 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION f(geom geometry, variadic rec anyarray) RETURNS json AS | |
$$ | |
BEGIN | |
RETURN | |
json_build_object( | |
'type', 'Feature', | |
'id', | |
'null', -- the GeoJson spec includes an 'id' field, but it is optional. some services still cry if it's not in there, so we leave it empty just for now. | |
'geometry', ST_AsGeoJSON(geom)::json, | |
'properties', json_build_object(variadic rec) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package at.triply.backend.eventbackend | |
import java.io.File | |
import java.nio.file.Files | |
import java.nio.file.Paths | |
import java.nio.file.StandardCopyOption | |
import java.util.concurrent.TimeUnit | |
object Main { | |
@JvmStatic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE PROCEDURE create_hex_grid(source_table_name varchar(30), height numeric = 1000, srid integer = 31287, | |
geom_column_name varchar(30) = 'geom', target_table_name varchar(30) = 'hexgrid') | |
LANGUAGE plpgsql | |
AS | |
$$ | |
DECLARE | |
_curs refcursor ; | |
_width NUMERIC := height * 0.866; | |
_geom GEOMETRY; | |
_hx GEOMETRY := ST_GeomFromText( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package at.triply.backend.test | |
import org.junit.jupiter.api.extension.ExtensionContext | |
import org.junit.jupiter.api.extension.TestExecutionExceptionHandler | |
import java.net.URLEncoder | |
class TestAdditionalOutputExtension : TestExecutionExceptionHandler { | |
override fun handleTestExecutionException(context: ExtensionContext?, throwable: Throwable) { | |
println("============================================================================================\n" + | |
"Hey, there seems to be something wrong with the test!\n" + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package at.triply.backend.test | |
import org.junit.jupiter.api.extension.ExtensionContext | |
import org.junit.jupiter.api.extension.TestExecutionExceptionHandler | |
import java.net.URLEncoder | |
class TestAdditionalOutputExtension : TestExecutionExceptionHandler { | |
override fun handleTestExecutionException(context: ExtensionContext?, throwable: Throwable) { | |
println("============================================================================================\n" + | |
"Hey, there seems to be something wrong with the test!\n" + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\copy (select cd.name, pv.id as variation_id, | |
st_distance_sphere(cd.location, pv.location) as distance, | |
cd.city, | |
cd.address, | |
li.name as product, | |
pv.stop as bus_stop, | |
ST_X(pv.location) as stopX, | |
ST_Y(pv.location) as stopY, | |
ST_X(cd.location) as customerX, | |
ST_Y(cd.location) as customerY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
... | |
implementation('org.springframework.boot:spring-boot-starter-security') | |
... | |
} |
NewerOlder