Skip to content

Instantly share code, notes, and snippets.

View igstan's full-sized avatar

Ionuț G. Stan igstan

View GitHub Profile
import java.util.Date
import java.util.concurrent.TimeUnit
import cats._
import cats.effect.{ExitCode, IO, IOApp}
import cats.implicits._
import cats.mtl.MonadState
igstan / kind-polymorphism.scala
Last active May 16, 2018 13:59 — forked from szeiger/gist:3a2e7e65b641bac9764a9c02de233ab9
Kind-polymorphic Any and Nothing
scala> import scala.language.higherKinds
import scala.language.higherKinds
scala> def f[C[_], E]: List[C[E]] = Nil
f: [C[_], E]=> List[C[E]]
scala> f[List, Int]
res0: List[List[Int]] = List()
scala> f[Any, Int]
igstan /
Last active November 20, 2015 09:36 — forked from danoneata/
Visitor pattern in Python
class Expr(object):
def accept(self, visitor):
method_name = 'visit_{}'.format(self.__class__.__name__.lower())
visit = getattr(visitor, method_name)
return visit(self)
class Int(Expr):
def __init__(self, value):
self.value = value
# ^^^ YAML documents must begin with the document separator "---"
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
igstan /
Last active December 25, 2015 21:39 — forked from aphyr/gist:7044081


It's actually more like a figure-eight cycle, though--depending on species. Wasps start out in the syconium full of male flowers, called a caprifig. The male wasps mate with the females immediately after pupation, and fertilize still incomplete female wasps. They dig a tunnel out of the caprifig then die; the female wasps escape via the tunnel, carrying male-flower pollen with them.

Female wasps then enter either caprifigs or figs--male or female syconia. If they enter a male syconium, they get to lay their eggs in the male flowers and the process starts anew. If they enter a female syconium, they can't lay eggs in the female flowers because they're shaped wrong, and die alone--but not before coating the female flowers in the male pollen from their birthplace.

The female syconium, if fertilized by wasps, develops seeds, is eaten, and gives rise to the next generation of fig trees. The syconium secretes digestive enzymes

package deiko
import scala.concurrent.Future
import scala.concurrent.duration.Duration
import scalaz.concurrent.Task
import play.api.libs.iteratee._
import Process._
object Conversion {
igstan / curried.rkt
Created December 25, 2012 00:13 — forked from anonymous/curried.rkt
Shorthand notation for curried functions in Racket.
#lang racket
(define ((add x) y)
(+ x y))
;; ((add 1) 2) -> 3
;; (add 1 2) -> arity mismatch error
igstan / DateUtils.scala
Created December 4, 2012 08:50 — forked from fcroiseaux/DateUtils.scala
Utils class to calculate and work with holidays in a country (here in Luxembourg)
package utils
import org.joda.time.{Period, LocalDate}
object DateUtils {
def dateRange(from: LocalDate, to: LocalDate, step: Period): Iterator[LocalDate] =
Iterator.iterate(from) {
dt =>
igstan /
Created August 22, 2012 20:08 — forked from DAddYE/
OSX For Hackers
# This is a script with usefull tips taken from:
# Run in interactive mode with:
# $ sh -c "$(curl -sL"
# or run it without prompt questions:
igstan / centered_triangle.html
Created May 3, 2011 13:47 — forked from romannurik/centered_triangle.html
A simple CSS trick to create a horizontally- or vertically-centered 'selected' callout triangle using zero images.
<!DOCTYPE html>
body {
margin: 40px;
a {
display: inline-block;