Skip to content

Instantly share code, notes, and snippets.

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
@laserlemon
laserlemon / introduction.md
Last active February 12, 2021 10:04
Rendering form errors for non-database-backed changesets

Introduction

Disclaimer: I'm a one-day-old Elixir/Phoenix developer.

In Sonny's training yesterday, we used an Ecto.Changeset to handle user registration (a database-backed operation). This worked perfectly for rendering the intial form and re-rendering the form with validation errors.

This is because our Workshop.RegistrationController is calling Repo.Insert which sets the changeset's :action, whether or not the insertion succeeds. Then Phoenix.HTML's form_for function appropriately sets errors on the form so they can be rendered on the page.

The Problem

@AndreasS2501
AndreasS2501 / Blockchains.md
Last active September 19, 2018 14:32
How to think an impossible thought?

On Blockchains - Postcapitalism - in response to: Postcapitalism by Jamie Dobson https://www.youtube.com/watch?v=MGdQnL4-H9M

An impossible thought?

But what do we want to think? I think many people want the same thing (see maslov pyramid of needs). But the ever interesting question in the history of humanity was: How to do that so that there exists an equilibrium between all humans (society) and the rest of the planet (nature). Personally I see post-capitalism as a part of a solution for that, but economy is only one thing that should change. To conceive such a complex balance is not a simple thing. Alan Kay often talks about how the internet has some biological ideas in it and yes I think to achieve that balance we need some kind of network organism where everyone is connected and heard. Even nature. So lets focus on that, the impossible thought: How can we live together in peace and prosperity with each other and nature? Sometimes, somehow this reminds me of the https://en.wikipedia.org/wiki/K

@angrycub
angrycub / README.md
Last active September 21, 2024 19:19
Erlang Supervisor Ghost Child Monitor

Erlang Supervisor Ghost Montior

Applies to:

  • Riak EE clusters with MDC:
    • 1.4.x - all versions
    • 2.0.x - all versions prior to Riak 2.0.7
    • 2.1.x - all version; fixed in 2.2.0

About

This workaround is a mitigation for basho/riak_kv#1178

package com.logentries.mq;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.logentries.api.Batch;
@mgwidmann
mgwidmann / while.ex
Last active November 20, 2022 20:03
An example of metaprogramming, extending the Elixir language, to add the while keyword. Taken from Chris McCord's example in his Metaprogramming Elixir book.
# The Elixir language is very extensible to allow for future additions or
# third party developers to take the language in directions that the original
# authors could not predict.
#
# Lets start with understanding what an Elixir macro is
iex> quote do
...> 1 + 1
...> end
{:+, [context: Elixir, import: Kernel], [1, 1]}
dynu.com
dyn.com
no-ip.com
noip.com
changeip.com
afraid.org
duckdns.org
dnsdynamic.org
duiadns.net
myonlineportal.com
@subfuzion
subfuzion / curl.md
Last active April 19, 2025 09:46
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@ericelliott
ericelliott / gitclean.sh
Created January 31, 2016 04:57
gitclean.sh - cleans merged/stale branches from origin
git remote prune origin
git branch -r --merged master | egrep -iv '(master|develop)' | sed 's/origin\///g' | xargs -n 1 git push --delete origin

This is unmaintained, please visit Ben-PH/spacemacs-cheatsheet

Useful Spacemacs commands

  • SPC q q - quit
  • SPC w / - split window vertically
  • SPC w - - split window horizontally
  • SPC 1 - switch to window 1
  • SPC 2 - switch to window 2
  • SPC w c - delete current window