Skip to content

Instantly share code, notes, and snippets.

View ioleo's full-sized avatar
🌊
Fighting the tide...

ioleo ioleo

🌊
Fighting the tide...
View GitHub Profile

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
@rodrigobaron
rodrigobaron / docker-compose-run
Last active August 2, 2016 07:04
Windows alternative to 'Interactive mode is not yet supported on Windows.' on docker-compose run issue
#!/bin/bash
function docker-compose-run() {
if [ "$1" = "-f" ] || [ "$1" = "--file" ] ; then
docker exec -i $(docker-compose -f $2 ps $3 |grep -m 1 $3 | cut -d ' ' -f1) "${@:4}"
else
docker exec -i $(docker-compose ps $1 | grep -m 1 $1 | cut -d ' ' -f1) "${@:2}"
fi
}
@jmauerhan
jmauerhan / wait.php
Last active August 5, 2017 21:34
Behat: Wait For AJAX Angular & jQuery
public function waitForAjax()
{
$waitTime = 10000;
try {
//Wait for Angular
$angularIsNotUndefined = $this->getSession()->evaluateScript("return (typeof angular != 'undefined')");
if ($angularIsNotUndefined) {
//If you run the below code on a page ending in #, the page reloads.
if (substr($this->getSession()->getCurrentUrl(), -1) !== '#') {
$angular = 'angular.getTestability(document.body).whenStable(function() {
@mpalourdio
mpalourdio / php-cs-fixer
Created November 12, 2014 21:24
@fabpot php-cs-fixer config for PhpStorm
parameters
--level=psr2 --verbose fix $FileDir$/$FileName$
working directory
$ProjectFileDir$
@matthiasg
matthiasg / docs style (bootstrap)
Created August 5, 2013 06:26
the callouts from the bootstrap documentation
/* Side notes for calling out things
-------------------------------------------------- */
/* Base styles (regardless of theme) */
.bs-callout {
margin: 20px 0;
padding: 15px 30px 15px 15px;
border-left: 5px solid #eee;
@johnpbloch
johnpbloch / composer.json
Created April 18, 2013 13:07
Install PHPUnit globally with composer
{
"name": "phpunit",
"description": "PHPUnit Composer Package",
"require": {
"phpunit/phpunit": "3.7.*"
},
"config": {
"bin-dir": "/usr/local/bin/"
}
}
@merk
merk / GlobalVariables.php
Last active December 16, 2015 07:49
Overriding or adding variables to the twig app variable
<?php
namespace Ibms\Helper;
use Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables as BaseGlobalVariables;
use Symfony\Component\DependencyInjection\ContainerInterface;
use DateTime;
class GlobalVariables extends BaseGlobalVariables
{
@Ocramius
Ocramius / User.php
Last active February 16, 2024 14:57
Doctrine 2 ManyToMany - the correct way
<?php
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity()
* @ORM\Table(name="user")
*/
class User
@xeoncross
xeoncross / Requests.php
Created April 11, 2012 21:44
cURL asynchronous requests using curl_multi and callbacks
<?php
/**
* Make asynchronous requests to different resources as fast as possible and process the results as they are ready.
*/
class Requests
{
public $handle;
public function __construct()
{
@innotekservices
innotekservices / jquery.spin.js
Created October 16, 2011 02:39
jQuery Plugin for Spin.js
/*
You can now create a spinner using any of the variants below:
$("#el").spin(); // Produces default Spinner using the text color of #el.
$("#el").spin("small"); // Produces a 'small' Spinner using the text color of #el.
$("#el").spin("large", "white"); // Produces a 'large' Spinner in white (or any valid CSS color).
$("#el").spin({ ... }); // Produces a Spinner using your custom settings.
$("#el").spin(false); // Kills the spinner.