Skip to content

Instantly share code, notes, and snippets.

View thepian's full-sized avatar

Henrik Vendelbo thepian

View GitHub Profile
FROM frolvlad/alpine-miniconda3
RUN apk --update add apk-tools-static busybox-static gcc flatpak musl-dev linux-headers python3-dev libjpeg-turbo-dev
RUN apk --update add gcc musl musl-dev linux-headers python3-dev libjpeg-turbo-dev
RUN pip install ptvsd maixpy3
@thepian
thepian / qemu_osx_rpi_raspbian_jessie.sh
Last active November 30, 2017 17:18 — forked from hfreire/qemu_osx_rpi_raspbian_jessie.sh
How to emulate a Raspberry Pi (Raspbian Jessie) on Mac OSX (El Capitan)
# Install QEMU OSX port with ARM support
sudo port install qemu +target_arm
export QEMU=$(which qemu-system-arm)
# Dowload kernel and export location
curl -OL \
https://github.com/dhruvvyas90/qemu-rpi-kernel/blob/master/kernel-qemu-4.4.34-jessie
export RPI_KERNEL=./kernel-qemu-4.4.34-jessie
# Download filesystem and export location
@thepian
thepian / SassMeister-input.scss
Created February 11, 2016 15:19
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
@mixin breaker($compact-selector) {
#{$compact-selector} & {
@content
}
}
## Writing testable HTML
When you want to test interaction in the UI, you often want to verify the state of a particular element. You might think of adding an id attribute so you can look up the element easily, but that is a bad solution.
The id attribute should only be used for elements that are inherently unique on the page. With changing requirements and future reuse it is hard to say which elements are unique. It also limits testing in parallel. If for instance a test runner renders a component multiple times without cleaning up the DOM to run the fastest, the test might not be working on the right element as 'getElementById' will not complain about multiple elements with the same id, it is also not defined which one it will get. Usually it is the first matching in the s a rule of thumb you should never use the id attribute outside pages served by the server; Never in views and templates.
To make an element easy to fetch in a test, put a unique attribute on it, and use CSS or xpath selector to match it
@thepian
thepian / gist:1699453
Created January 29, 2012 16:08
Better unicode
from __future__ import with_statement
import sys,os,yaml
def split_file(content,header):
if content[:3] == "---":
parts = content.split("---")
matter = yaml.load(unicode(parts[1],"utf-8")) or {}
for key in header.keys():
matter[key] = header[key]