This file contains hidden or 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 | |
branch1=$1 | |
branch2=$2 | |
diff=$(git diff $branch1 $branch2) | |
commitMessage=$(cat <<EOF | |
Generate a git commit message in the following format: |
This file contains hidden or 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
import kotlin.math.ceil | |
infix fun String.watterBomb(size: Int) = this.split("Y").map{ | |
ceil(it.length / size.toDouble()).toInt() | |
}.sum() | |
fun main() { | |
println("xxYxx" watterBomb 3 == 2) | |
println("xxYxx" watterBomb 1 == 4) | |
println("xxxxYxYx" watterBomb 5 == 3) |
This file contains hidden or 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
Command("example command" | |
"attribute1" to "value1", | |
"attribute2" to 123, | |
"attribute3" to false, | |
"attribute4" to 125.5 | |
) | |
Command.create("example command" | |
"attribute1" to "value1", | |
"attribute2" to 123, |
This file contains hidden or 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 org.learning.by.example.petstore.petcommands.service | |
import org.learning.by.example.petstore.petcommands.model.Pet | |
import reactor.core.publisher.Mono | |
interface PetCommands { | |
fun sendPetCreate(monoPet: Mono<Pet>): Mono<String> | |
} |
This file contains hidden or 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
/* | |
* Copyright (c) 2020 Learning by Example maintainers. | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is | |
* furnished to do so, subject to the following conditions: | |
* |
This file contains hidden or 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
import math | |
def fib(n): | |
F = [[1, 1], [1, 0]]; | |
if (n == 0): | |
return 0; | |
power(F, n - 1); | |
return F[0][0]; |
This file contains hidden or 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.juan.medina; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.Random; | |
import java.util.concurrent.*; | |
import java.util.concurrent.atomic.AtomicInteger; | |
public class AnimalRace { | |
public static final int RACE_LENGTH = 1000; |
This file contains hidden or 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
VerbalExpression regex = regex() | |
.startOfLine() | |
.then("+") | |
.capture().range("0", "9").count(3).maybe("-").maybe(" ").endCapture() | |
.count(3) | |
.endOfLine().build(); | |
VerbalExpression regex = expresion { |
This file contains hidden or 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
data class Person(var name: String, var age: Int) | |
class PersonContainer { | |
private val list = arrayListOf<Person>() | |
fun add(person: Person) = list.add(person) | |
fun get(): List<Person> = list | |
infix fun String.with(age: Int) = Person(this, age) | |
} | |
fun persons(init: PersonContainer.() -> Unit): List<Person> { |
This file contains hidden or 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
import java.io.File | |
open class CombineData(private val fileName: String) { | |
private fun getColumnValue(line: String, column: Pair<Int, Int>): String { | |
return line.substring(column.first, column.first + column.second - 1).trim().replace("*", "") | |
} | |
fun calculate( | |
value: Pair<Int, Int>, |
NewerOlder