Skip to content

Instantly share code, notes, and snippets.

@aembleton
aembleton / userChrome.css
Created February 17, 2022 12:45
Put inside firefox/$profile/chrome directory
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
/* to hide the native tabs */
#TabsToolbar {
visibility: collapse;
}
/* to hide the sidebar header */
#sidebar-header {
visibility: collapse;
@aembleton
aembleton / treestyletabs.css
Last active June 7, 2023 21:16
Tree Style Tabs CSS styling
/*
# 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 September 4, 2019 08:38
CSS improvements for grough.co.uk
#mai-rtmenu {
display: none;
}
#header {
display: none;
}
#main #mai-container #mai-content {
width: 100%;
#mai-rtmenu {
display: none;
}
#header {
display: none;
}
#main #mai-container #mai-content {
width: 100%;
@aembleton
aembleton / ListUtil.kt
Created August 5, 2017 23:51
pmap extension for List
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 August 19, 2016 15:50
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.
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 August 19, 2016 15:48
Find map keys that start with a given String
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
}
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 (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 / lastfm_top-tags.py
Created December 13, 2015 16:45
Add tags to MP3s
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys
def main(f):
if not os.path.splitext(f)[1].lower() == '.mp3':
err('usage')