Skip to content

Instantly share code, notes, and snippets.

View MartinSeeler's full-sized avatar

Martin Seeler MartinSeeler

View GitHub Profile
@flyfloor
flyfloor / gist:5ebc3cbeb1c89438444e9582748c175b
Created September 5, 2016 02:58
alfred use iterm2 as default terminal
-- This is v0.6 of the custom script for AlfredApp for iTerm 2.9+
-- Please see https://github.com/stuartcryan/custom-iterm-applescripts-for-alfred/
-- for the latest changes.
-- Please note, if you store the iTerm binary in any other location than the Applications Folder
-- please ensure you update the two locations below (in the format of : rather than / for folder dividers)
-- this gets around issues with AppleScript not handling things well if you have two iTerm binaries on your system... which can happen :D
on alfred_script(q)
if application "iTerm2" is running or application "iTerm" is running then
@hochgi
hochgi / PartitionWith.scala
Last active July 12, 2026 02:52
akka-stream retry flow
package hochgi.util
package object collections {
/**
* `partition` and `map` combined.
* for a given collection, and a function from the collection elements to `Either[A,B]`,
* generates a tuple of 2 collections of types `A` and `B`
*
* @param xs the collection of elements
* @param f a function that convert an element to an `Either[A,B]`
@kitze
kitze / one-liner-solution.js
Last active November 23, 2018 16:10
Solution
/*
* If the loop bumps into an function, it returns true, and moves on,
* but if it bumps into a number, it waits x milliseconds,
* it stops the _.every loop by returning false, and recursively
* calls the sequence function with the rest of the array.
* Nifty, huh? 😝😝
*/
const sequence = b => b.every((a, i) => !(a.call ? a() : setTimeout(() => sequence(b.slice(++i)), a)));
@knutwalker
knutwalker / FromMap.scala
Last active April 12, 2020 15:21
Converting Map[String,Any] to a case class using Shapeless - http://stackoverflow.com/q/31640565/2996265
/*
* Based on http://stackoverflow.com/a/31641779/2996265
*
* Changed:
* - use https://github.com/knutwalker/validation to accumulate errors
* - support lists as well (polymorphic on higher kinds would be better, though)
* - use -Xexperimental for java8 style SAM support
*/
@marick
marick / about_those_lava_lamps.md
Last active July 23, 2025 18:08
About Those Lava Lamps

Around 2006-2007, it was a bit of a fashion to hook lava lamps up to the build server. Normally, the green lava lamp would be on, but if the build failed, it would turn off and the red lava lamp would turn on.

By coincidence, I've actually met, about that time, (probably) the first person to hook up a lava lamp to a build server. It was Alberto Savoia, who'd founded a testing tools company (that did some very interesting things around generative testing that have basically never been noticed). Alberto had noticed that people did not react with any urgency when the build broke. They'd check in broken code and go off to something else, only reacting to the breakage they'd caused when some other programmer pulled the change and had problems.

@3noch
3noch / Functor.py
Last active December 20, 2021 21:41
Functors in Python
import types
global fmap_vtable
fmap_vtable = {}
def fmap_for(type):
def register_fmap(func):
fmap_vtable[type] = func
return func
@kolodny
kolodny / actions.js
Last active May 17, 2018 18:42
testing redux thunk middleware
export const doTheThing = () => (dispatch, getState) => {
const users = getState();
dispatch({
type: 'THE_THING',
users,
});
};
@knutwalker
knutwalker / Main.scala
Created August 25, 2015 12:31
Demonstrates various possibilities to declare a val and the resulting bytecode
/**
* Demonstrates various possibilities to declare a val and the resulting bytecode.
*
* Main takeaways are:
* - `private[this]` does not generate a getter and genertes direct field access
* - compile time constants are `final val x = e` with an optional modifier (§4.1)
* - final must be given, even if enclosing class is already final (§ 5.2 - 'final')
* - no type annotation may be present
*/
final class Main {
import shapeless._
import shapeless.labelled._
import shapeless.ops.record._
import scala.annotation.implicitNotFound
@implicitNotFound("Cannot prove that ${A} has an 'id: Int' field.")
trait HasId[A] {
def apply(a: A): Int
}
@gigiigig
gigiigig / auxpattern.scala
Last active September 9, 2026 21:57
Aux Pattern
import shapeless._
import scalaz._
import Scalaz._
object console extends App {
trait Foo[A] {
type B
def value: B