Skip to content

Instantly share code, notes, and snippets.

View nachinius's full-sized avatar
🏠
Working...

nachinius nachinius

🏠
Working...
  • Berlin, DE
View GitHub Profile

Fibers

Fibers are an abstraction over sequential computation, similar to threads but at a higher level. There are two ways to think about this model: by example, and abstractly from first principles. We'll start with the example.

(credit here is very much due to Fabio Labella, who's incredible Scala World talk describes these ideas far better than I can)

Callback Sequentialization

Consider the following three functions

@jamesmishra
jamesmishra / README.md
Last active March 25, 2024 20:02
Using Terraform to run a docker-compose.yml file directly on an Amazon EC2

Introduction

This is a Hashicorp Terraform module that provisions an AWS EC2 instance for the purpose of running a given docker-compose.yml file.

Usage

# ===== OUR MAGIC DOCKER-COMPOSE.YML FILE HERE =====
# It is also possible to get Terraform to read an external `docker-compose.yml`
# file and load it into this variable.
# We'll be showing off a demo nginx page.
pragma solidity ^0.5.2;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
* @dev The God
*/
contract GodOwner {
address payable _owner;
@changlinli
changlinli / Example.scala
Created March 19, 2018 04:45
Using path dependent types to ensure invariants in Scala
object StandardUnit {
type PersonId = Int
final class Person(id: PersonId, name: String)
object Person {
def lookupName(id: PersonId): Option[String] = ???
def lookupBlacklistStatus(id: PersonId): Option[Unit] = ???

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
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active July 4, 2024 23:40
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@dantudor
dantudor / gist:4594469
Last active April 28, 2017 21:28
Behat Tests in PHPUnit with Symfony 2.1
<?php
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\ConsoleOutput;
use Behat\Behat\Console\BehatApplication;
class BehatTest extends WebTestCase
{
/**