Skip to content

Instantly share code, notes, and snippets.

@jonmcclung
jonmcclung / print_dir.py
Created December 17, 2016 18:52
A script to pretty-print a directory in a cross-platform way.
import os, argparse
def get_prev(prev):
res = ''
for bar in prev[:-1]:
res += ' | ' if bar else ' '
return res + (' |' if prev[-1] else ' +') + '-- '
@jonmcclung
jonmcclung / Toast.qml
Last active July 19, 2024 14:10
Toast in QML. This implementation creates black toast with white text that appears at the bottom of the screen. It also supports adding multiple toast at a time using ToastManager with the newest toast at the bottom.
import QtQuick 2.0
/**
* adapted from StackOverflow:
* http://stackoverflow.com/questions/26879266/make-toast-in-android-by-qml
*/
/**
* @brief An Android-like timed message text in a box that self-destroys when finished if desired
*/