Skip to content

Instantly share code, notes, and snippets.

View hastebrot's full-sized avatar

Benjamin Gudehus hastebrot

  • Freiheit.com
  • Hamburg, Germany
  • 06:17 (UTC +02:00)
View GitHub Profile

1. Separation of immutable and mutable logic

Quite a lot of different people have been on the same trail of thought. Gary Bernhardt's formulation of a "functional core, imperative shell" seems to be the most voiced.

"Boundaries" - Gary Bernhardt

"Imperative shell" that wraps and uses your "functional core".. The result of this is that the shell has fewer paths, but more dependencies. The core contains no dependencies, but encapsulates the different logic paths. So we’re encapsulating dependencies on one side, and business logic on the other side. Or put another way, the way to figure out the separation is by doing as much as you can without mutation, and then encapsulating the mutation separately. Functional core — Many fast unit tests. Imperative shell — Few integration tests

https://www.youtube.com/watch?v=yTkzNHF6rMs

Mini Guide: kscript and kotlinx.coroutines

$ brew install holgerbrandl/tap/kscript
$ brew install maven
$ kscript demo.kts
Hello from Kotlin!
Hello,
World!
@hastebrot
hastebrot / jira-bookmarklets.md
Last active April 21, 2018 11:52
Browser Bookmarklets for Atlassian Jira

Browser Bookmarklets for Atlassian Jira

Jira is a proprietary issue tracking product, developed by Atlassian. It provides bug tracking, issue tracking, and project management functions.

"Jira (software)." Wikipedia, The Free Encyclopedia.

Usage:

"Installation" of a bookmarklet is performed by creating a new bookmark, and pasting the code into the URL destination field. Alternatively, if the bookmarklet is presented as a link, under some browsers it can be dragged and dropped onto the bookmark bar. The bookmarklet can then be run by loading the bookmark normally.

  • receive / send
  • subscribe / dispatch
  • in / out
  • from server / to server
  • to client / from client
  • input stream / output stream
  • source / sink

Okio includes its own stream types called Source and Sink that work like InputStream and OutputStream

@hastebrot
hastebrot / about:config.md
Created January 13, 2018 21:55 — forked from haasn/about:config.md
Firefox bullshit removal via about:config

Firefox bullshit removal

Due to the incessant swarm of complete and utter nonsense that has been forcing its way into Firefox over time, I've decided to start collecting my personal list of “must-have” about:config tweaks required to turn Firefox into a functional brower.

NOTE: Unfortunately this is somewhat out of date. The comments link to some resources that may be more up-to-date. Patches welcome.

WebSockets

These can be used for nefarious purposes and to bypass access restrictions.

Effective Engineer - Notes

What's an Effective Engineer?

  • They are the people who get things done. Effective Engineers produce results.

Adopt the Right Mindsets

Rough Notes about CQRS and ES

Once upon a time…

I once took notes (almost sentence by sentence with not much editing) about the architectural design concepts - Command and Query Responsibility Segregation (CQRS) and Event Sourcing (ES) - from a presentation of Greg Young and published it as a gist (with the times when a given sentence was heard).

I then found other summaries of the talk and the gist has since been growing up. See the revisions to know the changes and where they came from (aka the sources).

It seems inevitable to throw Domain Driven Design (DDD) in to the mix.

@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 {
<link rel="import" href="../polymer/polymer-element.html">
<dom-module id="dolphin-controller">
<script>
const clientContext = {
beanManager: {
onBeanUpdate: (callback) => {},
onArrayUpdate: (callback) => {},
notifyBeanChange: () => {},
notifyArrayChange: () => {},
@hastebrot
hastebrot / vanilla-js-cheatsheet.md
Created September 14, 2017 12:41 — forked from thegitfather/vanilla-js-cheatsheet.md
Vanilla JavaScript Quick Reference / Cheatsheet