Skip to content

Instantly share code, notes, and snippets.

View karlcow's full-sized avatar
⛩️
Working from … anywhere

Karl Dubost karlcow

⛩️
Working from … anywhere
View GitHub Profile
@karlcow
karlcow / webcompat-meta-explore.md
Created January 15, 2020 04:18
Exploration of metadata on webcompat.

A current report on webcompat.com

<!-- @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 -->

**URL**: https://www.reddit.com/r/RetroPie/comments/cjcrnk/pi4_overclock_vs_stock_dreamcast/

**Browser / Version**: Firefox Mobile 68.0
@karlcow
karlcow / blah.md
Created January 14, 2020 03:25
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. »

(function ($) {
var height = $.fn.height,
width = $.fn.width,
left = $.fn.left,
top = $.fn.top;
$.fn.extend({
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
karlcow / test_image.md
Last active November 21, 2019 02:56
Testing GitHub for images

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

first experiment.

Link an image

![amanite one](http://la-grange.net/tmp/amanite01.webp)

And check the markup and the server logs

@karlcow
karlcow / doctest_tdd.py
Created October 31, 2019 12:13
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')
'2019-10-31'
>>> post_date('Date: foobar')
@karlcow
karlcow / list.sh
Last active October 18, 2019 16:26
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
karlcow / larger_than.js
Created September 2, 2019 04:41
Iterate through the DOM to search element wider than a certain width.
// 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'])
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
* {
padding: 0;
margin: 0;
}
html,
body {
height: 100%;
overflow: hidden;
width: 100%;
}
@karlcow
karlcow / fastclick.md
Last active May 20, 2019 00:00
Documenting fastclick finding on webcompat.com