Skip to content

Instantly share code, notes, and snippets.

View taig's full-sized avatar

Niklas Klein taig

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
@pfn
pfn / 01 - iota dsl sample.scala
Last active September 1, 2016 22:25
sample of a strongly typed layout dsl for android results in http://i.imgur.com/KS7KLR6.png
package iota.sample
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.graphics.drawable.Animatable
import android.widget._
import android.view.ViewGroup.LayoutParams._
import iota._
class MainActivity extends AppCompatActivity { self =>
@etaty
etaty / JsonCirceBodyParser.scala
Created November 5, 2015 17:30
json circe play framework body parser
package utils
import java.nio.ByteBuffer
import cats.data.Xor
import io.circe.Json
import play.api.http.LazyHttpErrorHandler
import play.api.http.Status._
import play.api.libs.iteratee.{Iteratee, Traversable}
import play.api.mvc.BodyParsers.parse._

Git Cheat Sheet

Commands

Getting Started

git init

or

@mrbobbytables
mrbobbytables / init-boot2docker.sh
Created November 11, 2014 11:48
boot2docker OSX mount helper
#!/bin/bash
set -o errexit -o nounset -o pipefail
usage() {
cat << EOF
USAGE:
init-boot2docker.sh -p [path] -u [uid] -g [gid]
-p Path to the working directory you wish to mount.
-u The uid you wish to mount the working directory as.
@chrisbanes
chrisbanes / SystemUiHelper.java
Last active October 26, 2025 18:45
SystemUiHelper
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@staltz
staltz / introrx.md
Last active December 1, 2025 11:31
The introduction to Reactive Programming you've been missing
@pfn
pfn / build.sbt
Created October 18, 2013 22:39
example build.sbt for a single project with many library projects
import android.Keys._
android.Plugin.androidBuild
name := "project-with-lib-projects"
unmanagedClasspath in Compile <<= ( baseDirectory
, unmanagedClasspath in Compile) map {
(base,cp) =>
val ignores = Set("android-support-v4.jar", "guava-14.0.1.jar")
@pfn
pfn / build.scala
Last active December 21, 2015 02:49
Load an arbitrary project from git, include it as an Android Library Project in our main application build.
import sbt._
import android.ArbitraryProject
object SampleBuild extends Build {
import android.Keys._
import android.Dependencies.LibraryProject
// we're gonna pull tag android-sdk-support_r11 from the support repo
val supportGit = uri("https://android.googlesource.com/" +
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active November 11, 2025 10:27
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx