Skip to content

Instantly share code, notes, and snippets.

View truizlop's full-sized avatar
🏹
FP'ing with Bow

Tomás Ruiz-López truizlop

🏹
FP'ing with Bow
View GitHub Profile
@tonilopezmr
tonilopezmr / pre-commit-ktlint
Last active August 15, 2021 10:05
Pre-commit hook to run ktlint with auto-correct option and it adds the auto-correct changes into the commit.
#!/bin/sh
# https://github.com/shyiko/ktlint pre-commit hook
git diff --name-only --cached --relative | grep '\.kt[s"]\?$' | xargs ktlint -F --relative .
if [ $? -ne 0 ]; then exit 1; else git add .; fi

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
@JcMinarro
JcMinarro / PackPubBot.groovy
Last active February 1, 2019 08:56
Script that get the free book of the day and send info to slack
#!/usr/bin/groovy
import org.codehaus.jettison.json.JSONObject
import groovyx.net.http.ContentType
import groovyx.net.http.Method
import org.jsoup.Jsoup
import groovyx.net.http.HTTPBuilder
import org.jsoup.nodes.Document
@Grapes( @Grab('org.jsoup:jsoup:1.7.3'))
@Grapes( @Grab('org.codehaus.jettison:jettison:1.3.7'))
@alxsimo
alxsimo / ResourceHelper.java
Created March 12, 2016 14:51
[Android] Load resources from unit test
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.net.URL;
public class ResourceHelper {
public String convertFileToString(File file) throws Exception {
BufferedReader reader = new BufferedReader(new FileReader(file));
StringBuilder sb = new StringBuilder();
@pedrovgs
pedrovgs / LoadMoreDetector.java
Created July 30, 2015 15:08
Utility class to implement a load more feature using a RecyclerView widget.
/*
* Copyright (C) 2015 Karumi.
*
* 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