Skip to content

Instantly share code, notes, and snippets.

Avatar

Arthur Embleton aembleton

View GitHub Profile
@aembleton
aembleton / treestyletabs.css
Last active Aug 4, 2020
Tree Style Tabs CSS styling
View treestyletabs.css
/*
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
:root {
--grey-10: #f9f9fa;
--grey-40: #b1b1b3;
--grey-90: #0c0c0d;
@aembleton
aembleton / grough.css
Created Sep 4, 2019
CSS improvements for grough.co.uk
View grough.css
#mai-rtmenu {
display: none;
}
#header {
display: none;
}
#main #mai-container #mai-content {
width: 100%;
View moz-code.txt
#mai-rtmenu {
display: none;
}
#header {
display: none;
}
#main #mai-container #mai-content {
width: 100%;
@aembleton
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 = this.map{wrapTransorm(transform, it)}
return runBlocking { asyncOperations.map { it.await() } }
}
fun <I,O> wrapTransorm(transform: (I) -> O, input:I) = async(CommonPool) {transform(input)}
@aembleton
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) = this.map {
val components = it.split(split, limit=2)
components[0].trim() to components[1].trim()
}.toMap()
@aembleton
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
}
View keybase.md

Keybase proof

I hereby claim:

  • I am aembleton on github.
  • I am hiker (https://keybase.io/hiker) on keybase.
  • I have a public key ASDch2xpzBE1fntduHm0Jv_iY4WKDWu_2LQ8_oCLXperbAo

To claim this, I am signing this object:

View lastfm_top-tags.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys
def main(f):
if not os.path.splitext(f)[1].lower() == '.mp3':
err('usage')
@aembleton
aembleton / docx2md.md
Last active Jun 23, 2020 — forked from vzvenyach/docx2md.md
Convert a Word Document into MD
View docx2md.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

You can’t perform that action at this time.