Skip to content

Instantly share code, notes, and snippets.

@aappddeevv
aappddeevv / ImportUtilities.m
Last active August 29, 2015 14:11
mathematica delimited file importer
(* ::Package:: *)
(* :Title: Import Delimited *)
(* :Summary: Containts declarations for importing a delimited text file into a session. *)
BeginPackage["ImportUtilities`"]
(* Canned functions that can be used as arguments. *)
@aappddeevv
aappddeevv / Doc.scala
Created April 24, 2015 17:35
scala pretty printer
package org.im
package output
package prettyprinter
import scala.language._
import java.io.Writer
import java.time._
/**
@aappddeevv
aappddeevv / virtual-dom.scala
Created May 8, 2015 15:03
direct translation of virtual-dom example into scalajs, does not use functional idioms at all :-)
package tutorial.webapp
import language._
import scala.scalajs.js
import scala.scalajs.js.JSApp
import scala.scalajs.js.annotation.JSName
import org.scalajs.dom
import org.scalajs.jquery.jQuery
import dom.document
import scala.scalajs.js.timers._
@aappddeevv
aappddeevv / idrivebackend.py
Created January 4, 2016 02:50
duplicity, idrive, backend
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright 2015 aappddeevv <aappddeevv@gmail.com>
#
# This file is part of duplicity.
#
# Duplicity is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
@aappddeevv
aappddeevv / examples-akka-server.md
Last active October 11, 2017 08:19
akka, http, server

A relatively simple akka server with a few bells and whistes.

package example

import scala.language._
import akka.actor._
import akka.http.scaladsl
import scaladsl._
@aappddeevv
aappddeevv / xtract.md
Last active November 14, 2016 19:48
scala, xml, xtract, play functional

If you use "readers" similar to play's json reader framework, you know that its a nice framework to compose your json converters. There is a similar framework for reading XML from lucidchart called xtract.

xtract only provides XML reading. Its very similar to play json. Many of the examples that demonstrate the play json or xtract library are fairly simple and did not help me understand how to compose readers that need to have alternatives. For example, an XML fragment may have an element called Fault or an element called Data and you want to compose a reader that automatically handles both in one reader instance. How do you do that?

Here's some scalatest examples that show one way to do that. You have some choices about how to navigate and how to compose so pay special attention to the details in the tests. I prefer to compose by using readers at the top element and use and/or on the builders, but you can choose to do it anyway you wish.

import org.scalatest._

class readerspecs extends FlatSp
@aappddeevv
aappddeevv / redux-reducer-injectables.md
Last active March 5, 2018 04:34
react, redux, combineReducers

If you need a redux reducer that adds some "injectables" as the third argument to the reducers normally combined in redux's combineReducers, try this one:

/** 
 * A combineReducers replacement that adds additional arguments
 * to the reduction call to inject different values a reducer
 * might need, read-only, from other parts of the tree. Reducer
 * order calling is not specified. If no injectables are provided
 * the overall state is included under the key "_root_".
 *
 * @param {Object} reducers Reducer object. Each key with a function is included in a final reducer.

Hi!

My background:

  • things: ai/machine learning, data management (big, streaming, complex), blockchain, front-end
  • management consulting: multiple industries, health, fs, telco, m&e
  • business areas: sales, marketing and service, fintech/regtech
  • program management (i.e. $10m+ usd)
  • startup management (partner, busdev, CTO, etc.): product and proserv
  • hands-on or delegation-based depending on need
package test
import zio._
import zio.console._
type FakeExchange = Has[FakeExchange.Service]
object FakeExchange:
trait Service:
def blah(): UIO[Unit]