Skip to content

Instantly share code, notes, and snippets.

@nhalase
nhalase / echo.rs
Created June 3, 2023 18:52
Rust echo
use clap::Parser;
/// Rust echo
#[derive(Parser, Debug)]
#[command()]
struct Args {
/// Do not print the trailing newline character.
#[arg(short, num_args(0), required(false), default_value_t = false)]
no_newline: bool,
@nhalase
nhalase / zdt.js
Last active April 4, 2023 19:49
JS function to generate a Java ZonedDateTime
const pad = (value) => {
return value < 10 ? '0' + value : value;
}
const createOffset = (date) => {
const sign = (date.getTimezoneOffset() > 0) ? "-" : "+";
const offset = Math.abs(date.getTimezoneOffset());
const hours = pad(Math.floor(offset / 60));
const minutes = pad(offset % 60);
return sign + hours + ":" + minutes;
@nhalase
nhalase / game_goals.md
Created October 17, 2022 20:55
Game Goals

Progress

[X] - Elden Ring [X] - Horizon Zero Dawn [X] - Horizon Zero Dawn: The Frozen Wilds [X] - The Witcher 3 [X] - The Witcher 3: Hearts of Stone [X] - Yakuza 0 [X] - Yakuza Kiwami [X] - It Takes Two

@nhalase
nhalase / jsonb.kt
Created October 5, 2022 20:46
JSONB support (PostgreSQL)
import kotlinx.serialization.KSerializer
import kotlinx.serialization.json.Json
import kotlinx.serialization.serializer
import org.jetbrains.exposed.sql.Column
import org.jetbrains.exposed.sql.ColumnType
import org.jetbrains.exposed.sql.Table
import org.jetbrains.exposed.sql.statements.api.PreparedStatementApi
import org.postgresql.util.PGobject
inline fun <reified T : Any> Table.jsonb(
@nhalase
nhalase / flyway-free.conf
Created September 10, 2021 15:05
The base Flyway 7.15.0 conf file with all Flyway Teams options removed
# Copyright © Red Gate Software Ltd 2010-2021
#
# 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
# distributed under the License is distributed on an "AS IS" BASIS,
@nhalase
nhalase / .gitattributes-simple-starter
Created August 31, 2021 16:56
Simple .gitattributes Starter
# Common settings that generally should always be used with your language specific settings
# Auto detect text files and perform LF normalization
* text=auto
#
# The above will handle all files NOT found below
#
# Documents
@nhalase
nhalase / .gitattributes-java-starter
Last active August 31, 2021 16:55
Java/Kotlin .gitattributes
# Common settings that generally should always be used with your language specific settings
# Auto detect text files and perform LF normalization
* text=auto
#
# The above will handle all files NOT found below
#
# Java sources
@nhalase
nhalase / .gitignore-java-starter
Created August 31, 2021 15:49
VSCode, Vim, IntelliJ, Gradle, Maven, Java, macOS, Linux, and Windows .gitignore Starter
# Created by https://www.toptal.com/developers/gitignore/api/macos,windows,linux,vim,visualstudiocode
# Edit at https://www.toptal.com/developers/gitignore?templates=macos,windows,linux,vim,visualstudiocode
### Linux ###
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
@nhalase
nhalase / .gitignore-simple-starter
Last active August 31, 2021 15:40
VSCode, Vim, macOS, Linux, and Windows .gitignore Starter
# Created by https://www.toptal.com/developers/gitignore/api/macos,windows,linux,vim,visualstudiocode
# Edit at https://www.toptal.com/developers/gitignore?templates=macos,windows,linux,vim,visualstudiocode
### Linux ###
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
@nhalase
nhalase / Hello.kt
Created August 19, 2021 14:38
Kotlin println example
println("Hello!")