Skip to content

Instantly share code, notes, and snippets.

Working from … anywhere

Karl Dubost karlcow

Working from … anywhere
View GitHub Profile
karlcow /
Last active May 1, 2020
pre-html pour ymir
from datetime import datetime
from glob import glob
import locale
import re
from textwrap import dedent
import mistune
from PIL import Image
View foo.txt
./mach build
ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/", line 147, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/", line 97, in __get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type md5
ERROR:root:code for hash sha1 was not found.
Traceback (most recent call last):
karlcow /
Created Jan 15, 2020
Exploration of metadata on webcompat.

A current report on

<!-- @browser: Firefox Mobile 68.0 -->
<!-- @ua_header: Mozilla/5.0 (Android 9; Mobile; rv:68.0) Gecko/68.0 Firefox/68.0 -->
<!-- @reported_with: mobile-reporter -->


**Browser / Version**: Firefox Mobile 68.0
karlcow /
Created Jan 14, 2020
Sauter à la navigation

Dans les règles d’accessibilité, il est souvent proposer de mettre au début du document HTML, un lien pour lier directement le contenu, car traditionnellement la page commençait avec l’entête puis la navigation.

Mais flexbox peut changer la donne puisque l’on peut réordonner le contenu pour la présentation. Alors pourquoi ne pas mettre le contenu au début, avec lien « Sauter à la navigation. »

View scroller.js
(function ($) {
var height = $.fn.height,
width = $.fn.width,
left = $.fn.left,
top = $;
width: function () {
if (!this[0]) error();
if (this[0] == window) return self.innerWidth || $.boxModel && document.documentElement.clientWidth || document.body.clientWidth;
if (this[0] == document) return ((document.documentElement && document.compatMode == 'CSS1Compat') ? document.documentElement.scrollWidth : document.body.scrollWidth);
karlcow /
Last active Nov 21, 2019
Testing GitHub for images

The goal is to test what GitHub is really doing with the images.

first experiment.

Link an image

![amanite one](

And check the markup and the server logs

karlcow /
Created Oct 31, 2019
Trying to create an example of doctests for testing a function. Developed in the spirit of TDD.
import doctest
import datetime
def post_date(content):
Extract the date from the content
>>> post_date('Date: 2019-10-31')
>>> post_date('Date: foobar')
karlcow /
Last active Oct 18, 2019
listing files with date, size and path
# find .: search here
# -type f: file only
# -print: output format
# '%TY-%Tm-%Td: date iso
# %s : file size
# %p\n' : path and return
# |: pipe to another command
# column -t: the results are aligned
find . -type f -printf '%TY-%Tm-%Td %s %p\n' | column -t
karlcow / larger_than.js
Created Sep 2, 2019
Iterate through the DOM to search element wider than a certain width.
View larger_than.js
// Iterate through the DOM to search element wider than a certain width.
// Practical for issues with invisible blocks creating layout issues
// on mobile.
// set here the maxwidth of your choice.
var maxwidth = 414;
var startElem = document.getElementsByTagName('body')[0];
var items = startElem.getElementsByTagName("*");
for (var i = items.length; i--;) {
if (items[i].getBoundingClientRect()['width'] > maxwidth) {
console.log(items[i], items[i].getBoundingClientRect()['width'])
View sitewait-open-2019-08-27.txt
329 severity-critical 2019-07-16T17:55:32Z
803 severity-important 2019-06-20T14:25:42Z
861 null 2019-08-22T12:52:53Z
1061 severity-important 2019-08-22T14:16:19Z
1551 severity-critical 2019-08-23T11:50:25Z
1804 severity-important 2019-08-22T11:43:37Z
2005 severity-critical 2019-08-23T12:22:30Z
2009 severity-important 2019-08-22T13:56:12Z
2070 severity-critical 2019-08-22T13:05:51Z
2498 severity-important 2019-08-24T23:25:50Z
You can’t perform that action at this time.