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 com.natpryce.hamkrest.assertion.assertThat | |
| import com.natpryce.hamkrest.equalTo | |
| import org.junit.Test | |
| /* | |
| * The promotion service calculates discounts for promoted items. | |
| * (It's a bit crazy because it's also reducing the tax 🙄) | |
| * The Item class is classic DTO and its fields are not encapsulated. | |
| * | |
| * Make Item a rich object and encapsulate its fields 💪 |
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 com.intellij.execution.ExecutionException | |
| import com.intellij.execution.configurations.GeneralCommandLine | |
| import com.intellij.execution.configurations.PathEnvironmentVariableUtil | |
| import com.intellij.execution.process.ProcessOutput | |
| import com.intellij.execution.util.ExecUtil | |
| import com.intellij.ide.actions.CreateDesktopEntryAction | |
| import com.intellij.ide.actions.CreateLauncherScriptAction | |
| import com.intellij.openapi.application.ApplicationBundle | |
| import com.intellij.openapi.application.ApplicationNamesInfo | |
| import com.intellij.openapi.application.PathManager |
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
| :set -XOverloadedStrings | |
| :set prompt "" | |
| :set prompt-cont "" | |
| import Sound.Tidal.Context | |
| -- total latency = oLatency + cFrameTimespan | |
| tidal <- startTidal (superdirtTarget {oLatency = 0.1, oAddress = "127.0.0.1", oPort = 57120}) (defaultConfig {cFrameTimespan = 1/20}) | |
| :{ |
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 com.intellij.codeInsight.daemon.DaemonCodeAnalyzer | |
| import com.intellij.codeInsight.daemon.impl.analysis.FileHighlightingSetting.FORCE_HIGHLIGHTING | |
| import com.intellij.codeInsight.daemon.impl.analysis.FileHighlightingSetting.SKIP_HIGHLIGHTING | |
| import com.intellij.codeInsight.daemon.impl.analysis.HighlightLevelUtil | |
| import com.intellij.codeInsight.daemon.impl.analysis.HighlightingLevelManager | |
| import com.intellij.lang.injection.InjectedLanguageManager | |
| import com.intellij.openapi.project.Project | |
| import liveplugin.PluginUtil | |
| import liveplugin.currentFile | |
| import liveplugin.registerAction |
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 com.intellij.concurrency.JobScheduler | |
| import com.intellij.openapi.Disposable | |
| import com.intellij.openapi.application.Application | |
| import com.intellij.openapi.application.ApplicationManager | |
| import com.intellij.openapi.ui.popup.Balloon | |
| import com.intellij.openapi.ui.popup.JBPopupFactory | |
| import com.intellij.openapi.util.Disposer | |
| import com.intellij.ui.Gray | |
| import com.intellij.ui.LightColors | |
| import com.intellij.ui.awt.RelativePoint |
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 com.intellij.openapi.actionSystem.AnActionEvent | |
| import com.intellij.openapi.editor.EditorModificationUtil | |
| import com.intellij.openapi.editor.LogicalPosition | |
| import static liveplugin.PluginUtil.currentEditorIn | |
| import static liveplugin.PluginUtil.registerAction | |
| static def process(AnActionEvent event, Closure callback) { | |
| def editor = currentEditorIn(event.project) |
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
| { | |
| "title": "Change fn + i/j/k/l' to arrow keys", | |
| "rules": [ | |
| { | |
| "description": "Change fn + i/j/k/l' to arrow keys", | |
| "manipulators": [ | |
| { | |
| "type": "basic", | |
| "from": { | |
| "key_code": "i", |
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 com.intellij.execution.ExecutionManager | |
| import com.intellij.execution.Executor | |
| import com.intellij.execution.executors.DefaultRunExecutor | |
| import com.intellij.execution.filters.TextConsoleBuilderFactory | |
| import com.intellij.execution.ui.ConsoleView | |
| import com.intellij.execution.ui.ConsoleViewContentType | |
| import com.intellij.execution.ui.ExecutionConsole | |
| import com.intellij.execution.ui.RunContentDescriptor | |
| import com.intellij.execution.ui.actions.CloseAction | |
| import com.intellij.icons.AllIcons |
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
| fun main(args: Array<String>) { | |
| val f = create { | |
| println(1) | |
| yield() // 1 | |
| println(2) | |
| yield() // 2 | |
| println(3) | |
| } | |
| f.resume() // starts "f" | |
| f.resume() // continues from "yield 1" |
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 katas.kotlin.aaa | |
| import katas.kotlin.shouldEqual | |
| import org.junit.Test | |
| data class Cell(val x: Int, val y: Int) | |
| data class Board(val cells: List<Cell> = emptyList()) { | |
| fun evolve(): Board { | |
| val newCells = cells.mapNotNull { cell -> |