Skip to content

Instantly share code, notes, and snippets.

Benjamin Gudehus hastebrot

Block or report user

Report or block hastebrot

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hastebrot
hastebrot / ctpuzzle.c
Created Nov 24, 2019
Solver for the c't puzzle by Uli Schuhmacher.
View ctpuzzle.c
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define C if
#define T void
#define P NULL
#define U while
#define Z break
#define S return
#define L typedef
@hastebrot
hastebrot / Blocks.txt
Last active Nov 6, 2019
Unicode Character Database (12.1.0)
View Blocks.txt
# Blocks-12.1.0.txt
# Date: 2019-03-08, 23:59:00 GMT [KW]
# © 2019 Unicode®, Inc.
# For terms of use, see http://www.unicode.org/terms_of_use.html
#
# Unicode Character Database
# For documentation, see http://www.unicode.org/reports/tr44/
#
# Format:
# Start Code..End Code; Block Name
View StoreonDemo.js
import React from "react"
import createStore from "storeon"
import useStoreon from "storeon/react"
import StoreContext from "storeon/react/context"
import produce from "immer"
import { Pane, Button } from "fannypack"
export default () => {
return (
<StoreContext.Provider value={store}>
View RenderDemo.js
import React, { Fragment, useState, useEffect } from "react"
// this is similar to react's render().
export default () => {
const [state, setState] = useState({ count: 1 })
// this is similar to react's componentDidMount().
useEffect(() => {
setState({ count: 2 })
timeout(500, () => {
View Age of empires II AI Scripting
; The official HD AI
; An Artificial Intelligence Script written by Archon and Promiskuitiv
; Get in contact with Promiskuitiv by sending a mail to neuernamae@web.de
; List of taunts it reacts to:
; Standard taunts.
; 33 - Stop slinging resources. If slinging is requested early and is immediately canceled it may mess up the strategy.
; 38 - Sling Resources. Human player only, stops any unit production except for civilian units.
View functional core, imperative shell.md

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

View miniguide-kscript-coroutines.md

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 Apr 21, 2018
Browser Bookmarklets for Atlassian Jira
View jira-bookmarklets.md

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.

View in-out.md
  • 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 Jan 13, 2018 — forked from haasn/about:config.md
Firefox bullshit removal via about:config
View about:config.md

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.

You can’t perform that action at this time.