Skip to content

Instantly share code, notes, and snippets.

{
"from": 0, "size": 20, "track_total_hits": true,
"query": { "bool": {
"must": [ { "bool": {
"should": [
{ "constant_score": { "boost": 100, "filter": { "multi_match": {
"query": "trifase", "type": "best_fields", "tie_breaker": 0.2,
"operator": "and", "analyzer": "ey_italian",
"fields": ["searchable_title_strong", "searchable_title"]
} } } }, /* EXACT */
@nicmart
nicmart / editorial-guidelines.md
Created May 21, 2026 13:00
EY Editorial guidelines

Editorial Guidelines for LX Articles

This document is consumed by the /lx-llm-job-tick subagent whenever a job's prompt references "editorial guidelines" (e.g. "rewrite following editorial guidelines", "apply editorial guidelines", "clean up per the guidelines"). The subagent must enforce every rule below before writing the new revision.

These guidelines are about structure and notation, not voice or content — the subagent should not rewrite the author's ideas, only

@nicmart
nicmart / Formula fisica piu famos.md
Last active April 19, 2026 18:32
New Lexical editor in EY

Premessa

Ho letto, qualche mese fa, "Perché $E=mc^2$ ?" di Brian Cox e Jeff Forshaw edito da Hoepli. Mi è sembrata un'interessante, e direi anche appassionata, divulgazione sulla relatività. Poi magari nel momento cruciale lascia qualche perplessità ed insieme però anche desiderio di approfondire.

Ho allora scritto alcuni appunti per chiarirmi meglio i principali concetti. Già che c'ero, ho pensato di pubblicarli nel mio blog, non tanto per affermare "così stanno le cose", quanto piuttosto per stimolare all'approfondimento qualche fisico di maggior valore che dovesse per caso leggerli, sia precisandoli o anche correggendoli, sia proponendo qualche suo lavoro di maggior peso.

La formula fisica più famosa

SET SESSION RUNTIMECAP '300 minutes';
CREATE TABLE IF NOT EXISTS "gametransaction" (
"amountReal_eur" FLOAT,
"gameTransactionId" VARCHAR(255),
"jackpotAmount_base" FLOAT,
"walletAmount" FLOAT,
"betslipId" VARCHAR(255),
"reason" VARCHAR(255),
"jackpotContribution_base" FLOAT,
@nicmart
nicmart / droste.md
Last active November 24, 2020 12:24

Droste for the really really impatient

For this tutorial we'll be using a simplified version of our expression tree. Our expressions accept only binary expressions that combine Integers and Strings using plus and minus operators. The rules are simple:

  • Adding or subtracting two integers is allowed. The result is the sum/subtraction of both numbers
  • Adding two strings or a string and an integer is allowed. The result will be the result of concatenating both operands as if they were strings
  • Subtracting a String from an int (or vice versa) is not allowed
Unique Predicates:
List(
Predicate("Num", List(Var("T0"))),
Predicate("Mult", List(Var("T0"), Point, Var("T1"))),
Predicate("Mult", List(Var("T0"), Var("T1"), Var("T2"))),
Predicate("Mult", List(Var("T0"), Var("T2"), Var("T3"))),
Predicate("Mult", List(Var("T0"), Var("T3"), Var("T4")))
)
Time to Compute Substitutions: 315ms
Time to Remove Empty Subst: 0ms
import scalaz.zio.IO
import scala.io.StdIn
object Example {
case class MyError(text: String)
def readOption(availableOptions: Set[String]): IO[InvalidOption, String] =
IO.effectTotal(StdIn.readLine()).flatMap { input =>
if (availableOptions.contains(input)) IO.succeed(input)
else IO.fail(InvalidOption(input, availableOptions))
@nicmart
nicmart / final.scala
Created July 12, 2018 11:01
Introduction to Finally Tagless Encodings
//2 + (3 + 4)
// 9 (evaluate)
// "(2 + (3 + 4))" (pretty printing)
trait AddLanguage[T] {
def literal(n: Int): T
def add(m: T, n: T): T
}
def expr[T](lang: AddLanguage[T]): T = {
@nicmart
nicmart / rectangle.scala
Created February 6, 2018 22:48
Rectangle search algo
package example
case class Rectangle(x1: Int, x2: Int, y1: Int, y2: Int) {
def xInterval: Interval = Interval(x1, x2)
def yInterval: Interval = Interval(y1, y2)
}
case class Interval(from: Int, to: Int) {
def contains(x: Int): Boolean = x >= from && x <= to
def intersect(other: Interval): Boolean = to > other.from && from < other.to
}
@nicmart
nicmart / symantics.scala
Created December 19, 2017 22:43
Experiments with a tagless final encoding for the simply typed lambda-calculus, following section 3 of the paper "Typed Tagless Final Interpreters" by Oleg Kiselyov
import scala.language.higherKinds
trait Symantics[F[_,_]] {
def int[E](n: Int): F[E, Int]
def add[E](n: F[E, Int], m: F[E, Int]): F[E, Int]
def z[E, T]: F[(T, E), T]
def s[E, T, A](f: F[E, T]): F[(A, E), T]
def lam[E, A, B](f: F[(A, E), B]): F[E, A => B]
def app[E, A, B](f: F[E, A => B], a: F[E, A]): F[E, B]
}