Skip to content

Instantly share code, notes, and snippets.

View obecker's full-sized avatar

Oliver Becker obecker

  • Hamburg, Germany
View GitHub Profile
@obecker
obecker / QueryBuilder.kt
Created November 6, 2023 09:56
Proposal for a QueryBuilder to be used with org.http4k:http4k-connect-amazon-dynamodb
import org.http4k.connect.amazon.dynamodb.mapper.DynamoDbIndexMapper
import org.http4k.connect.amazon.dynamodb.model.Attribute
import org.http4k.connect.amazon.dynamodb.model.AttributeName
import org.http4k.connect.amazon.dynamodb.model.AttributeValue
class Query(
val keyConditionExpression: String?,
val filterExpression: String?,
val expressionAttributeNames: Map<String, AttributeName>?,
val expressionAttributeValues: Map<String, AttributeValue>?
@obecker
obecker / cf-worksheets.js
Created March 4, 2018 10:24
Input helper for Computer Futures worksheets - to be used with a browser extension like cjs (Custom JavaScript for websites)
/******************************************************************************************
* Input helper for Computer Futures worksheets
* - adds automatically missing zeros (9 -> 09:00)
* - computes total day working time and displays it also in human readable form (7.42 -> 7:25)
* - enables cursor navigation between input fields
* - removes all pre-filled entries from an empty worksheet
* (c) Oliver Becker, 2016-2018
******************************************************************************************/
(function() {
@obecker
obecker / FizzBuzz.swift
Last active February 8, 2017 03:50
FizzBuzz implementation in Swift
let numbers = AnySequence { () -> AnyGenerator<Int> in
var i = 1
return anyGenerator {
return i++
}
}.lazy
let fizzes = numbers.map { $0 % 3 == 0 ? "Fizz" : "" }
let buzzes = numbers.map { $0 % 5 == 0 ? "Buzz" : "" }
@obecker
obecker / Routes.swift
Last active November 5, 2015 11:37
Solving the shortest grid path problem in Swift
indirect enum Route : CustomStringConvertible {
case End
case Down(Route)
case Left(Route)
var description: String {
switch self {
case .End: return ""
case .Down(let way): return "⬇︎\(way)"
case .Left(let way): return "⬅︎\(way)"