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 com.github.toastshaman.json.reader; | |
import io.vavr.Function0; | |
import io.vavr.Function1; | |
import io.vavr.Function2; | |
import io.vavr.Function3; | |
import io.vavr.Function4; | |
import org.json.JSONObject; | |
import java.util.Arrays; |
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 com.example.demo.fp; | |
import io.vavr.control.Try; | |
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; | |
import org.springframework.transaction.support.TransactionTemplate; | |
import java.util.List; | |
import java.util.Objects; | |
import java.util.Optional; | |
import java.util.function.*; |
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
#!/usr/bin/env python3 | |
# pip3 install pathvalidate | |
# pip3 install pillow | |
# brew install libffi libheif | |
# pip3 install pyheif | |
import sqlite3 | |
import base64 | |
import io |
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
#!/bin/bash | |
set -euxo pipefail | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
brew install --cask alacritty | |
brew install --cask iterm2 | |
brew install --cask visual-studio-code | |
brew install --cask cyberduck |
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
FROM openjdk:14-jdk-alpine3.10 | |
ENV PLANTUML_VERSION=1.2022.4 | |
ENV LANG en_US.UTF-8 | |
RUN \ | |
apk add --no-cache graphviz wget ca-certificates && \ | |
apk add --no-cache graphviz wget ca-certificates ttf-dejavu fontconfig && \ | |
mkdir /app && \ | |
wget "https://github.com/plantuml/plantuml/releases/download/v${PLANTUML_VERSION}/plantuml-${PLANTUML_VERSION}.jar" -O /app/plantuml.jar && \ | |
apk del wget ca-certificates | |
RUN ["java", "-Djava.awt.headless=true", "-jar", "/app/plantuml.jar", "-version"] |
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
function git_random_branch() { | |
randomword=`shuf /usr/share/dict/words | head -1 | awk '{print tolower($0)}'` | |
branchname="kevin_${randomword}" | |
git create-branch -r ${branchname} | |
} | |
git_random_branch() |
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
// uses value4k: https://github.com/fork-handles/forkhandles/tree/trunk/values4k | |
class PaginationToken private constructor(value: String) : StringValue(value) { | |
companion object : NonBlankStringValueFactory<PaginationToken>(::PaginationToken) | |
} | |
data class PagedResult<T>( | |
private val result: List<T> = emptyList(), | |
val token: PaginationToken? = null | |
) : List<T> by result { | |
companion object |
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
fun <R> retry( | |
maxAttempts: Int, | |
action: () -> R | |
): R { | |
require(maxAttempts > 0) { "maxAttempts must be greater than 0" } | |
return runCatching(action).getOrElse { | |
val leftAttempts = maxAttempts.dec() | |
if (leftAttempts == 0) throw it | |
retry(leftAttempts, action) | |
} |
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
function OrderFactory($http) { | |
function Order(order) { | |
angular.extend(this, order || {}); | |
this.toppings = this.toppings || {}; | |
} | |
Order.prototype.addTopping = function(topping) { | |
this.toppings.push(topping); | |
}; |
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
<html ng-app="app"> | |
<head> | |
<meta charset="utf-8"> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/mathjs/1.0.1/math.js"></script> | |
</head> | |
<body ng-controller="MoneyController as ctrl"> | |
<p> | |
Total: <input type="number" ng-model="ctrl.total"> | |
</p> |
NewerOlder