Skip to content

Instantly share code, notes, and snippets.

View fkowal's full-sized avatar

Maciej Kowalski fkowal

  • Allegro Group
  • Poznań
View GitHub Profile
@jdegoes
jdegoes / zio-test.scala
Last active October 13, 2024 16:17
Simple example of testing with ZIO environment
object test {
import scalaz.zio._
type UserID = String
case class UserProfile(name: String)
// The database module:
trait Database {
val database: Database.Service
@dacr
dacr / gatling-simple.sc
Last active April 2, 2023 10:12
Just ONE ammonite script file to execute a load performance test using gatling ! / published by https://github.com/dacr/code-examples-manager #ea7a4259-9461-44a8-99fa-1ec6ec3c48ed/6bc5335f1571c83edc6278c55499c9c7ae43a5c0
// summary : Just ONE ammonite script file to execute a load performance test using gatling !
// keywords : scala, gatling, ammonite, scala, load-test, performance
// publish : gist
// authors : David Crosson
// license : Apache NON-AI License Version 2.0 (https://raw.githubusercontent.com/non-ai-licenses/non-ai-licenses/main/NON-AI-APACHE2)
// id : ea7a4259-9461-44a8-99fa-1ec6ec3c48ed
// created-on : 2018-09-22T07:41:07Z
// managed-by : https://github.com/dacr/code-examples-manager
// execution : scala ammonite script (http://ammonite.io/) - run as follow 'amm scriptname.sc'
import $ivy.`io.circe::circe-parser:0.11.1`
import io.circe._, io.circe.parser._, io.circe.syntax._
for {
input <- parse(repl.clipboard.read).right
toAdd <- parse("""{"new_field": "added programatically"}""").right
} repl.clipboard.write(input.deepMerge(toAdd).toString)
@noelwelsh
noelwelsh / reader-monad.md
Last active October 23, 2020 14:27
Discovering the Reader Monad

The Reader Monad

The reader monad is one solution to "dependency injection". This document shows how we might discover the reader monad when we attempt to solve this problem.

Dependency Injection

Our working definition of the dependency injection problem will be this: we have a method or function that takes certain parameters that we don't want to specify every time we call it. For example, we might have a function that gets a user given an ID and also requires a database connection.

def getUser(db: DbConnection, id: Id): User =
@battermann
battermann / fpmaxpureapp.scala
Created August 8, 2018 18:37
reimplementation of the program from "FP to the Max" by John De Goes (https://www.youtube.com/watch?v=sxudIMiOo68) with PureApp (https://github.com/battermann/pureapp)
import $ivy.`com.github.battermann::pureapp:0.6.0`
import com.github.battermann.pureapp._
import com.github.battermann.pureapp.interpreters.Terminal._
import cats.effect.IO
import cats.implicits._
import scala.util.Try
object Main extends StandardPureApp[IO] {

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@adamwiggins
adamwiggins / adams-heroku-values.md
Last active November 5, 2024 21:40
My Heroku values

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

@juandopazo
juandopazo / gist:3174141
Created July 25, 2012 03:03
YUI AMD loader
var YUI_config = {};
(function (YUI, global) {
var modules = {};
var justLoaded = [];
var AMD_prefix = '~AMD~';
function nameFromPath(path) {
var parts = path.split(/\//g).pop().split(/\./g),
ext = parts.pop();
@juandopazo
juandopazo / gist:1305379
Created October 22, 2011 01:04
Loading AMD modules from YUI
(function (window) {
var lastModule;
// configFn for all patterns that match an AMD-like module
// For now, only modules starting with ./ or ../ are recognized as being AMD-like
// Support for regular expressions in the patterns configuration was requested in ticket #2531324
// In the future the goal is to filter everything that looks like a file
// Any other AMD module must be declared in the "modules" config like any other module
function defConfigFn(config) {