Skip to content

Instantly share code, notes, and snippets.

View mulya's full-sized avatar

Rinat Mulyukov mulya

View GitHub Profile
@gvolpe
gvolpe / di-in-fp.md
Last active April 24, 2024 20:51
Dependency Injection in Functional Programming

Dependency Injection in Functional Programming

There exist several DI frameworks / libraries in the Scala ecosystem. But the more functional code you write the more you'll realize there's no need to use any of them.

A few of the most claimed benefits are the following:

  • Dependency Injection.
  • Life cycle management.
  • Dependency graph rewriting.
@WebReflection
WebReflection / multiple-uploads.md
Last active June 30, 2021 14:12
Uploading multiple files at once, and without jQuery

The aim of this gist is to fix the following informative post about uploading via XHR.

Fixing the HTML

The first part is the HTML. First of all, you really don't need JavaScript to upload a file but you do need a proper form. Secondly, inputs in a form shouild have a name, because the name is what the server will receive: not IDs, names!

Following the fixed form part.

@Akjir
Akjir / AccessGranted.scala
Last active August 28, 2019 21:06
Access private fields and methods using Java Reflection in Scala.
object Main extends App {
val printer = new Printer[String]()
val break = true
val text = "access granted"
//cannot be accessed:
//printer.printCodeName
//printer.codeName = "Rejewski"
//printer.printCodeName
@jmhofer
jmhofer / Build.scala
Last active December 20, 2016 11:49
SBT build for Scalatron (see also https://github.com/jmhofer/scalatron-bot.g8)
// copy all jars from Scalatron's distribution (bin directory) into lib/
lazy val botDirectory = settingKey[File]("bot-directory")
lazy val play = taskKey[Int]("Plays a game of Scalatron, returns the exit code upon completion.")
lazy val Versions = new {
lazy val Specs2 = "3.8.6"
}
lazy val root = (project in file(".")).settings(