Skip to content

Instantly share code, notes, and snippets.

Arthur Embleton aembleton

Block or report user

Report or block aembleton

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
aembleton / ListUtil.kt
Created Aug 5, 2017
pmap extension for List
View ListUtil.kt
public fun <I,O> List<I>.pmap(transform: (I) -> O): List<O> {
val asyncOperations ={wrapTransorm(transform, it)}
return runBlocking { { it.await() } }
fun <I,O> wrapTransorm(transform: (I) -> O, input:I) = async(CommonPool) {transform(input)}
aembleton / ListExtension.kt
Created Aug 19, 2016
Create a map from a list of Strings. Split the string with a splitter String. Useful for reading in a list of comma seperated String and converting them into a map.
View ListExtension.kt
fun List<String>.mapWith(split:String) = {
val components = it.split(split, limit=2)
components[0].trim() to components[1].trim()
aembleton / MapExtension.kt
Created Aug 19, 2016
Find map keys that start with a given String
View MapExtension.kt
fun <V> Map<String,V>.startsWith(search:String):V? {
val reducedMap = this.toSortedMap().tailMap(search)
if (!reducedMap.isEmpty() && reducedMap.firstKey().startsWith(search)) {
return reducedMap.values.first()
return null
View IteratorMap.kt
public inline fun <T,R> Iterator<T>.map(transform: (T) -> R) : List<R> {
val list = ArrayList<R>()
this.forEach { list.add(transform(it)) }
return list

Keybase proof

I hereby claim:

  • I am aembleton on github.
  • I am hiker ( on keybase.
  • I have a public key ASDch2xpzBE1fntduHm0Jv_iY4WKDWu_2LQ8_oCLXperbAo

To claim this, I am signing this object:

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys
def main(f):
if not os.path.splitext(f)[1].lower() == '.mp3':
aembleton /
Last active Aug 12, 2019 — forked from vzvenyach/
Convert a Word Document into MD

Converting a Word Document to Markdown in One Move

The Problem

A lot of important government documents are created and saved in Microsoft Word (*.docx). But Microsoft Word is a proprietary format, and it's not really useful for presenting documents on the web. So, I wanted to find a way to convert a .docx file into markdown.

Installing Pandoc

On a mac you can use homebrew by running the command brew install pandoc.

The Solution

aembleton / gist:5063b7f2ad6889e06f27
Created Jul 15, 2015
Use apache commons StringUtils to pretty print an arrayt
View gist:5063b7f2ad6889e06f27
"(" + StringUtils.join(params, ",") + ")"
aembleton / getPrettyDateRange.php
Created Apr 15, 2015
PHP function to create a date range such as '1st - 4th May 2015' or '28th August - 2nd September 2015'
View getPrettyDateRange.php
function getPrettyDateRange($fromDate, $toDate) {
$fromTime = strtotime($fromDate);
$toTime = strtotime($toDate);
$fromDay = date("jS", $fromTime);
$fromMonth = date("F", $fromTime);
$fromYear = date("Y", $fromTime);
$toDay = date("jS", $toTime);
$toMonth = date("F", $toTime);
aembleton / Ordnance-Survey.tms
Created Feb 19, 2015
Ordnance Survey map to be used in QLandkarte GT.
View Ordnance-Survey.tms
<Title>Ordnance Survey</Title>
<Layer idx="0">
function convert(z1, x1, y1)
serverpart = 0
serverpart = (serverpart + 1) % 4;
function encodeQuadTree(zoom, tilex, tiley)
You can’t perform that action at this time.