Skip to content

Instantly share code, notes, and snippets.

View hastebrot's full-sized avatar

Benjamin Gudehus hastebrot

  • Freiheit.com
  • Hamburg, Germany
  • 06:25 (UTC +02:00)
View GitHub Profile
@hastebrot
hastebrot / AddCookiesInterceptor.java
Created November 3, 2017 23:31 — forked from tsuharesu/AddCookiesInterceptor.java
Handle Cookies easily with Retrofit/OkHttp
/**
* This interceptor put all the Cookies in Preferences in the Request.
* Your implementation on how to get the Preferences MAY VARY.
* <p>
* Created by tsuharesu on 4/1/15.
*/
public class AddCookiesInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
@hastebrot
hastebrot / vanilla-js-cheatsheet.md
Created September 14, 2017 12:41 — forked from thegitfather/vanilla-js-cheatsheet.md
Vanilla JavaScript Quick Reference / Cheatsheet
@hastebrot
hastebrot / MonadicNullSafety.kt
Created January 13, 2017 07:12 — forked from janojanahan/MonadicNullSafety.kt
Kotlin Nullable can behave like a monad
/**
* A Gist proving that Kotlin's nullable type can be made into a monad without wrapping into another
* object and satisfy the Monadic laws
*
* Kotlin has comprehensive null safety built into the language enforced at compile time, using its
* nullable type.
*
* Its language structure makes dealing with nullable values simple and succinct. Unlike other language
* monadic constructs such as Option (scala), Optional(Java8+) and Maybe(Haskell), it is enforced at
* compile time and is compatible with existing non monad aware API (for example,
@hastebrot
hastebrot / tmux.conf
Created January 7, 2017 12:51 — forked from spicycode/tmux.conf
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@hastebrot
hastebrot / Permutations.kt
Created July 1, 2016 20:12 — forked from voddan/Permutations.kt
code for "A handful of Kotlin permutations"
package permutations
import java.util.*
interface Circular<T> : Iterable<T> {
fun state(): T
fun inc()
fun isZero(): Boolean // `true` in exactly one state
fun hasNext(): Boolean // `false` if the next state `isZero()`
@hastebrot
hastebrot / MathExtensions.kt
Created June 24, 2016 16:36 — forked from MichaelRocks/MathExtensions.kt
Math extension functions and float-math functions for Kotlin
/*
* Copyright 2015 Michael Rozumyanskiy
*
* 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
@hastebrot
hastebrot / bret_victor-reading_list.md
Created February 13, 2016 00:54 — forked from nickloewen/bret_victor-reading_list.md
Bret Victor’s Reading List

This is a plain-text version of Bret Victor’s reading list. It was requested by hf on Hacker News.


Highly recommended things!

This is my five-star list. These are my favorite things in all the world.

A few of these works have had an extraordinary effect on my life or way of thinking. They get a sixth star. ★

@hastebrot
hastebrot / springer-free-maths-books.md
Created December 28, 2015 18:10 — forked from bishboria/springer-free-maths-books.md
Springer have made a bunch of maths books available for free, here are the direct links
@hastebrot
hastebrot / Accent.py
Last active September 22, 2015 01:01 — forked from endolith/Accent.py
Documenting the matplotlib colormaps
# https://github.com/matplotlib/matplotlib/issues/881
# Several of the ColorBrewer maps are "qualitative", meaning
# they are just a group of colors that can be used together
# for categories of data. So I remapped Accent to segments
# instead of continuous:
# Actually, these should be used with ListedColormap, and
# the number of colors should depend on the number of
# categories in the data, with colors removed from the
# list in a certain order?