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 buildLanguageBattleChart({battleData, containerEl, oldLanguage, newLanguage}) { | |
const dates = battleData.map(d => d.date); | |
const newLanguageFiles = battleData.map(d => d.newLanguageFiles); | |
const oldLanguageFiles = battleData.map(d => d.oldLanguageFiles); | |
const filesRatios = battleData.map(d => d.filesRatio * 100); | |
const canvas = document.createElement('canvas'); | |
canvas.style = 'width: 600px; height: 400px'; | |
containerEl.appendChild(canvas); |
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 buildSimpleLineChart({data, containerEl, title, xField, yField, xTitle, yTitle}) { | |
const xs = data.map(d => d[xField]); | |
const ys = data.map(d => d[yField]); | |
const canvas = document.createElement('canvas'); | |
canvas.style = 'width: 600px; height: 400px'; | |
containerEl.appendChild(canvas); | |
return new Chart(canvas, { | |
data: { |
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 | |
## | |
# Outputs the top 10 committers on the provided area, for the period provided, | |
# based on the number of commits, in the form of 4 columns: | |
# Lines added, Lines deleted, Number of commits, Author | |
# (This allows for easily re-sorting the output by piping it into `sort -nr -k COLUMN_NUMBER`) | |
# | |
# Tip: replace tabs with commas everywhere below to output valid CSV content. | |
## |
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.malt.architecture.libfreelancer | |
import com.malt.architecture.shouldNotDependOnModulesOfOtherGroups | |
import org.junit.jupiter.api.Tag | |
import org.junit.jupiter.api.Test | |
@Tag("lib-freelancer") | |
internal class CheckFreelancerLibsDependenciesTest { | |
@Test |
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
/** | |
* Specifies a command to be executed with some arguments. | |
* | |
* For a better development experience, this class must be extended to ensure each command has | |
* an specification type, and must define the queue name via: | |
* - either a static field (for Java classes) named "COMMAND_NAME", | |
* - or a companion object's property (for Kotlin classes) named "COMMAND_NAME". | |
*/ | |
abstract class CommandSpecification( |
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
data class ExecutionPolicy( | |
/** How many processes (coroutines, really) to run in parallel. */ | |
val concurrency: Int, | |
/** | |
* How much time to wait before processing a command specification/scheduled task. | |
* | |
* Consequently, that time is the window during which tasks are subject to deduplication. | |
* |
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
commandScheduler.scheduleSequence( | |
CommandSpec1(argA, argB), | |
CommandSpec2(), | |
CommandSpec3(argC) | |
) |
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
class CommandQueue(...) { | |
// ... | |
override fun schedule(command: CommandSpecification) { | |
// add task to queue, log details, emit metrics | |
schedule(ScheduledTask( | |
command, | |
queueName, | |
clock, | |
// this is the important part for deduplication to work |
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
const val MY_QUEUE_NAME: String = "myServiceQueue" | |
@Configuration | |
class MyServiceQueueConfiguration { | |
@Bean(MY_QUEUE_NAME) | |
fun myServiceQueue(commandExecutionQueueFactory: CommandExecutionQueueFactory) = | |
commandExecutionQueueFactory.createQueue( | |
MY_QUEUE_NAME, |
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
@Component | |
class ClientCode( | |
@Named(MY_QUEUE_NAME) | |
private val commandScheduler: CommandScheduler | |
) { | |
fun doSomething() { | |
// ... some code ... | |
val transactionId: TransactionId = ... | |
val invoiceId: InvoiceId = ... | |
commandScheduler.schedule(PushTransactionForInvoiceSpec(transactionId, invoiceId)) |
NewerOlder