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
aembleton / docx2md.md
Last active Oct 20, 2019 — 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

@aembleton
aembleton / Ignore certificate for HttpURLConnection in Android.java
Created Mar 27, 2011
The following code disables SSL certificate checking for any new instances of HttpsUrlConnection
View Ignore certificate for HttpURLConnection in Android.java
/**
* Disables the SSL certificate checking for new instances of {@link HttpsURLConnection} This has been created to
* aid testing on a local box, not for use on production.
*/
private static void disableSSLCertificateChecking() {
TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return null;
}
@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:

@aembleton
aembleton / StringUtils.scala
Last active Dec 28, 2015
Implict String Utilities
View StringUtils.scala
package util
/**
* Created with IntelliJ IDEA.
* User: arthur
* Date: 17/11/13
* Time: 22:26
* To change this template use File | Settings | File Templates.
*/
object StringUtils {
You can’t perform that action at this time.